//k1编辑 2022.2.19
//红蓝阵营文件不同

corpseRd_del_crew2 = {
	{ if(!alive _x)then{_this deleteVehicleCrew _x} } forEach crew _this;
};
Escape_create_intelMak = {
	Escape_intel_find = 1;
	publicVariable "Escape_intel_find"; //
	{
		_x params ["_pos", "_mak"];
		deleteMarker _mak;
		Escape_intelMaks = Escape_intelMaks - [_x];
	} forEach Escape_intelMaks;
	//Escape_intelMaks = [];
	_pos = Escape_intel_box getPos [random (Escape_intel_Range - 10), random 360];
	_make = createMarker ["Escape_intel_mak", _pos];
	_make setMarkerShape "ELLIPSE";
	_make setMarkerSize [Escape_intel_Range, Escape_intel_Range]; //
	_make setMarkerColor "ColorRed";
	_make setMarkerBrush "Border";
	
	_make = createMarker ["Escape_intel_mak2", _pos];
	_make setMarkerType "hd_dot";
	_make setMarkerSize [.4,.4];
	_make setMarkerColor "ColorGreen";
	_make setMarkerText "情报所在区域";
	
	if ({Escape_intel_box distance _x < 3} count (call A3E_fnc_GetPlayers) > 0) exitWith {};
	["找到情报放置的大概位置."] call drn_fnc_CL_ShowTitleTextAllClients;
	0 spawn {_t = time + 5; waitUntil {time > _t}; ["情报也许藏在该区域的某个房子里."] call drn_fnc_CL_ShowTitleTextAllClients};
};
Escape_shelling_intelPos = {
	_check = false;
	_t = time + 1;
	waitUntil {if (time > _t) then {_ply = attachedTo Escape_intel_box; _check = (!isNull _ply && {!(_ply in Escape_Players_enemy)}); _t = time + 1}; _check};
	Escape_intel_takenAway = 1;
	for "_i" from 1 to 6 do {
		if (random 100 < 60) then {
			_pos = getpos Escape_intel_box;
			_strikesuccess = [_pos] call a3e_fnc_FireArtillery;
		};
		_t = time + (10 + random 20);
		waitUntil {time > _t};
	};
};
Escape_vehWep_check2 = {
	private ["_haveWep", "_veh", "_turretPaths"];
	_haveWep = false;
	_veh = vehicle _this;
	if (_veh isKindOf "Tank") exitWith {_haveWep = true; _haveWep};
	if (!(_veh isKindOf "Car") && {!(_veh isKindOf "Ship")}) exitWith {_haveWep};
	_turretPaths = allTurrets _veh; //[[-1]] + 
	{if (count(_veh weaponsTurret _x) != 0) exitWith {_haveWep = true}} forEach _turretPaths;
	_haveWep
};
Escape_minDisUnit = {
	private ["_minDis", "_dis", "_ply", "_units", "_Players"];
	_minDis = 999999;
	_ply = objNull;
	_units = [];
	_Players = call A3E_fnc_GetPlayers - Escape_Players_enemy - [Player_Server];
	{ if(!(vehicle _x in _units) && {_x getVariable ["FAR_isUnconscious", 0] == 0} && {_x call Escape_vehWep_check2})then{_units pushback vehicle _x} } forEach _Players;
	if (count _units == 0) then {{ if(!(vehicle _x in _units) && {_x getVariable ["FAR_isUnconscious", 0] == 0} && {!isNull objectParent _x})then{_units pushback vehicle _x} } forEach _Players};
	if (count _units == 0) then {{ if(_x getVariable ["FAR_isUnconscious", 0] == 0)then{_units pushback _x} } forEach _Players};
	if (count _units == 0) then {_units = _Players};
 	{
		_dis = _this distance _x;
		if (alive _x && {_dis < _minDis}) then {
			_ply = _x;
			_minDis = _dis;
		};
	} forEach _units;
	_ply
};
Escape_minDisVeh = {
	private ["_minDis", "_dis", "_ply", "_units", "_Players"];
	params ["_uav","_enemy"];
	_minDis = 300;
	_ply = _enemy;
	_units = [];
	_Players = (call A3E_fnc_GetPlayers) - [Player_Server] - (if(A3E_VAR_Side_Opfor getFriend A3E_VAR_Side_Ind < .6 && {A3E_VAR_Side_Ind getFriend A3E_VAR_Side_Opfor < .6})then[{[]},{Escape_Players_enemy}]);
	{ if(!(vehicle _x in _units) && {_x getVariable ["FAR_isUnconscious", 0] == 0} && {_x call Escape_vehWep_check2} && {_enemy distance _x < _minDis})then{_units pushback vehicle _x} } forEach _Players;
	if (count _units == 0) then {{ if(!(vehicle _x in _units) && {_x getVariable ["FAR_isUnconscious", 0] == 0} && {!isNull objectParent _x} && {_enemy distance _x < _minDis})then{_units pushback vehicle _x} } forEach _Players};
	if (count _units == 0) then {{ if(_x getVariable ["FAR_isUnconscious", 0] == 0 && {_enemy distance _x < _minDis} && {_uav knowsAbout _x >= 3})then{_units pushback _x} } forEach _Players};
 	{
		_dis = _enemy distance _x;
		if (alive _x && {_dis < _minDis}) then {
			_ply = _x;
			_minDis = _dis;
		};
	} forEach (_units - [_enemy]);
	selectRandom [_ply,_enemy]
};
DB_hel_debug = {
	private ["_ply", "_dir", "_pos", "_heli_grp1", "_heli_grp2"];
	if (alive _this && {alive (driver _this)}) then {
		_heli_grp1 = group _this;
		{deleteVehicle _x} forEach units _heli_grp1;
		createVehicleCrew _this;
		_heli_grp2 = group _this;
		(units _heli_grp2) joinSilent _heli_grp1;
		deleteGroup _heli_grp2;
		_ply = _this call Escape_minDisUnit;
		_dir = _this getDir _ply;
		_pos = _ply getPos [([500, 999] call BIS_fnc_randomInt), _dir];
		_this doMove _pos;
	};
}; //防止悬停或者着陆
DR_fn_setPosAGLS = {
	params ["_obj", "_pos"];
	_pos set [2, worldSize]; 
	_obj setPosASL _pos;
	_pos set [2, vectorMagnitude (_pos vectorDiff getPosVisual _obj)];
	_obj setPosASL _pos;
};
DR_spawn_laser = {
	params ["_veh","_tag"];
	_class = switch (side _veh) do {
		case west: {"LaserTargetW"};
		case east: {"LaserTargetE"};
		default {"LaserTargetW"};
	};
	_laser = _class createVehicle (visiblePositionASL _tag);
	_laser
};
Escape_setSkills = {
	params ["_unit","_a"];
	{_unit setSkill _x} forEach [["endurance", _a],["spotDistance", _a],["spotTime", _a],["courage", _a],["reloadSpeed", _a],["commanding", _a],["general", _a],["aimingSpeed", _a],["aimingShake", _a],["aimingAccuracy", _a]];
};
Escape_fnc_plyDisMax = {
	private ["_plys","_plys2","_dis","_disMax"];
	_plys = allPlayers - [entities "HeadlessClient_F", Player_Server] - Escape_Players_enemy;
	_plys2 = [];
	{if (alive _x && {isPlayer _x}) then {_plys2 pushback _x}} forEach _plys;
	if (count _plys2 == 0) then {_plys2 = _plys};
	_disMax = 0;
	{
		_dis = _x distance2D _this;
		if (_dis > _disMax) then {_disMax = round _dis};
	} forEach _plys;
	_disMax
};

call compile preprocessFileLineNumbers "config.sqf";
call compile preprocessFileLineNumbers ("Island\WorldConfig.sqf");

_debug = a3e_debug;

// Initialization

a3e_var_Escape_firstPreloadDone = false;

if (isNil "a3e_var_commonLibInitialized") then {call compile preprocessFileLineNumbers "Scripts\DRN\CommonLib\CommonLib.sqf"};

a3e_var_Escape_playerEnteredWorld = false;
onPreloadFinished {
	if (!a3e_var_Escape_firstPreloadDone) then {
		a3e_var_Escape_firstPreloadDone = true;
		if (!isNull player) then {
            a3e_var_Escape_playerEnteredWorld = true;
            removeAllWeapons player;
            removeAllItems player;
            removeBackpack player;
		};
	};
	onPreloadFinished {};
};

enableSaving [false, false];

a3e_arr_JipSpawnPos = [];
//call compile preprocessFileLineNumbers "Scripts\DRN\CommonLib\CommonLib.sqf";
//call drn_fnc_CL_InitParams;

waitUntil {!isNil "A3E_ParamsParsed"}; //等待服务器解析设置参数

call compile preprocessFileLineNumbers "Scripts\Escape\Functions.sqf";
call compile preprocessFileLineNumbers "Scripts\Escape\AIskills.sqf";

setTerrainGrid Param_Grass;

if (isServer) then {
	[] execVM 'kk\MoveOutDead.sqf'; //搬出尸体
	if (Escape_unitsts == 1) then {[] execVM "kk\unitsts_mak.sqf"};
	if (Escape_Extr_mak isEqualType 0) then {Escape_Extr_mak = if(Escape_Extr_mak == 1)then[{true},{false}]};

    a3e_var_Escape_hoursSkipped = 0;
    if (isMultiplayer) then [{
        private ["_hour"];
        _hour = if(Param_TimeOfDay == 24)then[{floor random 24},{Param_TimeOfDay}];
        a3e_var_Escape_hoursSkipped = _hour - (date select 3);
        publicVariable "a3e_var_Escape_hoursSkipped";
        setDate [date select 0, date select 1, date select 2, _hour, 0];
    },{
		{if (_x != p1) then {deleteVehicle _x}} forEach units group player;
	}];
};
//AI缓存隐藏远处的AI提升FPS
//[AiCacheDistance(players),TargetFPS(-1 for Auto),Debug,CarCacheDistance,AirCacheDistance,BoatCacheDistance] execVM "zbe_cache\main.sqf";
if (isServer && {Escape_zbe_cache == 1}) then {[700,0,false,200,2000,700] execVM "zbe_cache\main.sqf"};
[] execVM "Engima\Civilians\init.sqf"; //城镇平民
if (isNil "PARKEDVEHICLES_GetParamValue") then {[] execVM "Engima\ParkedVehicles\init.sqf"}; //随机空车

if (Escape_VCOMAI == 1) then {
	call VCM_fnc_VcomInit;
	call VCM_fnc_VcomInitClient;
	if (isServer && {isNil "CBA_Settings_fnc_init"}) then {Escape_VCMSET = 1; publicVariable "Escape_VCMCBASET"};
	0 spawn {
		if (!isServer) then {uiSleep 5};
		if (isNil "Escape_VCMSET") exitWith {};
		VCM_FFEARTILLERY = false;
		VCM_SKILLCHANGE = false;
		VCM_SIDESPECIFICSKILL = false;
		VCM_HEARINGDISTANCE = 400;
		VCM_WARNDIST = 500;
		VCM_STATICARMT = 350;
		VCM_MINECHANCE = 5;
	};
}; //AI增强模组

FAR_kill_Score = true; //
FAR_allow_kill = true; //
FAR_spectating_type = "SIDE"; //
FAR_bleed_creep2 = [20,99]; //
//FAR_disable_Friend = 1; ////
//FAR_callAI_dist = 300; //
//FAR_water_rs = false; //不允许水下救人和止血
if (FAR_Enable isEqualType 0) then {FAR_Enable = if(FAR_Enable == 1)then[{true},{false}]};
if (FAR_killFriend isEqualType 0) then {FAR_killFriend = if(FAR_killFriend == 1)then[{true},{false}]};
if (FAR_cam_mod isEqualType 0) then {FAR_cam_mod = if(FAR_cam_mod == 1)then[{true},{false}]};
if (FAR_cam_free isEqualType 0) then {FAR_cam_free = if(FAR_cam_free == 1)then[{true},{false}]};
if (FAR_in_Spectator isEqualType 0) then {FAR_in_Spectator = if(FAR_in_Spectator == 1)then[{true},{false}]};
if (FAR_death_Score isEqualType 0) then {FAR_death_Score = if(FAR_death_Score == 1)then[{true},{false}]};
if (FAR_Talk_chat isEqualType 0) then {FAR_Talk_chat = if(FAR_Talk_chat == 1)then[{true},{false}]};
if (FAR_map_gps isEqualType 0) then {FAR_map_gps = if(FAR_map_gps == 1)then[{true},{false}]};
if (FAR_map_mak isEqualType 0) then {FAR_map_mak = if(FAR_map_mak == 1)then[{true},{false}]};
if (FAR_death_Effect isEqualType 0) then {FAR_death_Effect = if(FAR_death_Effect == 1)then[{true},{false}]};
if (FAR_shot_creep isEqualType 0) then {FAR_shot_creep = if(FAR_shot_creep == 1)then[{true},{false}]};
if (allow_civ_medic isEqualType 0) then {if(allow_civ_medic == 1)then{FAR_SIDE_Medic = [civilian]; FAR_join_side = true}};
if (FAR_Remove_body isEqualType 0) then {FAR_Remove_body = if(FAR_Remove_body == 1)then[{true},{false}]};
FAR_revive_script = {
	params ["_unit", "_medic"];
	_isPlayer = false;
	if (isPlayer _medic && {player == _medic}) then {
		if (isNil "Escape_enemySW_side") then {
			_killNum = _unit getVariable ["Escape_Kill_num", 0];
			if (_killNum <= 0) exitWith {};
			_num = Escape_ReviveKill_num / 2;
			if (_killNum < _num) then {_num = _killNum};
			_killNum2 = player getVariable ["Escape_Kill_num", 0];
			player setVariable ["Escape_Kill_num", _killNum2 + _num, true];
			[format["<t color='#fff000'>救治队友 获得: %1人</t>", _num],-1,.05 * safezoneH + safezoneY,8,0,0,33] spawn BIS_fnc_dynamicText;
			call Escape_killNum_show;
		};
		_isPlayer = true;
	};
	if (_medic getVariable ["FAR_SIDE_Medic",false]) exitWith {_medic setVariable ["FAR_SIDE_Medic", nil,true]}; //
	if (local _unit) then [{[_unit,_isPlayer] call Escape_fn_KillNum},{Escape_KillNum_pv = [_unit,_isPlayer]; publicVariable "Escape_KillNum_pv"}];
};
FAR_callAI_condition = {
	_killNum = player getVariable ["Escape_Kill_num", 0];
	if (_killNum >= Escape_ReviveKill_num) exitWith {true};
	[format["<t color='#fff000'>AI救治杀敌人数不够 还需: %1人</t>", Escape_ReviveKill_num - _killNum],-1,.05 * safezoneH + safezoneY,8,0,0,33] spawn BIS_fnc_dynamicText;
	false
};
FAR_callAI_checkCond = {
	params ["_ai", "_tag"];
	if (_tag getVariable ["Escape_Kill_num", 0] < Escape_ReviveKill_num && {!(_ai getVariable ["FAR_SIDE_Medic",false])}) exitWith {true};
	false
}; //
FAR_KnockDown_script = {
	if (isNil "Escape_enemySW_side") then [{
		if (_this select 1 == -1 && {player getVariable ["FAR_once_eh",true]}) then {
			_killNum = player getVariable ["Escape_Kill_num", 0];
			if (_killNum == 0) exitWith {};
			_num = _killNum - Escape_FriendKill_num;
			if (_num < 0) then {_num = 0};
			player setVariable ["Escape_Kill_num", _num, true];
			[format["<t color='#ff0000' size = '.8'>误伤友军-%1个杀敌人数！</t>", Escape_FriendKill_num],-1,.25 * safezoneH + safezoneY,8,0,0,33] spawn BIS_fnc_dynamicText;
			systemchat format["误伤友军-%1个杀敌人数！", Escape_FriendKill_num];
			call Escape_killNum_show;
		};
	},{
		if (rating player < 0) then {player addRating (abs rating player)};
	}];
};
0 spawn compile preprocessFileLineNumbers "FAR_revive2\FAR_revive_init.sqf";

if (kk_fog_mass isEqualType 0) then {kk_fog_mass = if(kk_fog_mass == 1)then[{true},{false}]};
0 spawn {if (!isDedicated) then {waitUntil {!isNil "kk_initPlayerLocal"}}; uiSleep 5; if (kk_fog_mass) then {[] execVM "kk\kk_fog.sqf"}}; //浓雾天气

if(isNil "a3e_var_Escape_SearchLeader_civilianReporting")then{a3e_var_Escape_SearchLeader_civilianReporting = false}; //
if(isNil "Player_Server")then{Player_Server = objNull}; //

//服务器与玩家执行
[] execVM "CRS\init.sqf";
[] execVM "kk\zlt_fieldrepair.sqf"; //修车
[] execVM 'kk\close_combat.sqf'; //近战攻击
if(Escape_AI_UN == 1)then{[] execVM 'kk\Unconscious.sqf'}; //AI无意识
if(Escape_FFIS == 1)then{[] execVM 'kk\FFIS.sqf'}; //交火改进
if(Escape_3Dmarkers == 1)then{[] execVM 'kk\3Dmarkers.sqf'}; //3D地图标记
if(Escape_kk_throw == 1)then{0 spawn compile preprocessFileLineNumbers 'kk\kk_throw.sqf'}; //精准投掷
call compile preprocessFileLineNumbers "kk\CorpseRecycled.sqf"; //自动删除尸体
/////////////////////////////////////////////////////////////////////////////////////////////////////////
if (isDedicated) exitWith {}; ////

KILLHINT_SOUND = 1;
if (Escape_MOD1 isEqualType 0) then {Escape_MOD1 = if(Escape_MOD1 == 1)then[{true},{false}]};
if (Escape_MOD2 isEqualType 0) then {Escape_MOD2 = if(Escape_MOD2 == 1)then[{true},{false}]};
if (Escape_MOD3 isEqualType 0) then {Escape_MOD3 = if(Escape_MOD3 == 1)then[{true},{false}]};
if (Escape_MOD4 isEqualType 0) then {Escape_MOD4 = if(Escape_MOD4 == 1)then[{true},{false}]};
if (Escape_MOD5 isEqualType 0) then {Escape_MOD5 = if(Escape_MOD5 == 1)then[{true},{false}]};

Escape_PlyToFriendly = {
	_veh = vehicle _this;
	[player] join _this; //
	titleText ["", "BLACK IN", 2];
	_center = getPosASL _this;
	if (_this == _veh) then [{
		if (Escape_RespawnPos_sw) then [{player setPosASL _center},{_pos = [_center, 100, 500,3,0] call BIS_fnc_findSafePos; player setPos _pos}]; //
	},{
		if (Escape_RespawnPos_sw) then [{
			if (alive _veh && {abs speed _veh > 0 || {_veh isKindOf "air"}} && {_veh emptyPositions "Cargo" > 0 || {_veh emptyPositions "Gunner" > 0} || {_veh emptyPositions "Commander" > 0} || {_veh emptyPositions "Driver" > 0}}) then [{
				player moveInAny _veh;
			},{
				_dir = getDir _veh;
				_relPos = [_veh, -10, _dir] call BIS_fnc_relPos;
				player setPosASL [_relPos select 0,_relPos select 1,getPosASL _veh select 2];
				player setDir _dir;
				_relPos spawn {sleep .1; if (getPos player select 2 > 5) then {player setVelocity [0,0,0]; player setPos _this}};
			}];
		},{
			_pos = [_center, 100, 500,3,0] call BIS_fnc_findSafePos; //
			player setPos _pos;
		}];
	}];
};
Escape_fn_delay = {
	Escape_delay_time2 = time + 300;
	if (!isNil "Escape_delay_var2") exitWith {};
	Escape_delay_var2 = 1;
	waitUntil {
		_out = round (Escape_delay_time2 - time);
		Escape_delay_time22 = abs _out;
		sleep 1;
		_out <= 0
	};
	Escape_delay_var2 = nil;
	Escape_en_enemySW = true;
};
Escape_get_enemySW = {
	params ["_side", "_Players"];
	_units = [];
	_disMIN = 1000;
	_disMAX = 2000; //
	_t = time + 3;
	while {count _units == 0 && {_disMAX < 99999} && {time < _t}} do {
		_Players = _Players - Escape_Players_enemy - [player];
		{
			_ai = _x;
			if (side _ai == _side && {!isPlayer _ai} && {!unitIsUAV vehicle _ai} && {Escape_MutinyUseWep == 0 || {!(_ai call Escape_vehWep_check)}} && {{_ai distance _x < _disMIN} count _Players == 0} && {{_ai distance _x < _disMAX} count _Players > 0}) then {_units pushback _x};
		} forEach allUnits;
		_disMAX = _disMAX + 1000;
		sleep .001;
	};
	_units
};
Escape_enemyAddAct = {
	if (isNull objectParent player) then {
		Escape_use_act2 = nil;
		0 spawn {
			_ply = player;
			_idx = _ply addAction ["<t color='#4169E1'>获得四轮摩托</t>",{
				Escape_use_act1 = 1;
				Escape_use_act2 = 1;
				_veh = createVehicle ["C_Quadbike_01_F", [0,0,999], [], 0, "CAN_COLLIDE"];
				_dir = getDir player;
				_pos = player getRelPos [2.5, 0];
				_veh setDir _dir;
				if (getPosATL player select 2 > .2) then [{_pos set [2, getPosASL player select 2]; _veh setPosASL _pos},{_veh setPos _pos}];
				player moveInAny _veh;
			}, [], -1, false, true, "", "isNil 'Escape_use_act1' && {isNull objectParent player}"];
			_idx2 = _ply addAction ["<t color='#4169E1'>获得摩托艇</t>",{
				Escape_use_act1 = 1;
				Escape_use_act2 = 1;
				_veh = createVehicle ["C_Scooter_Transport_01_F", [0,0,999], [], 0, "CAN_COLLIDE"];
				_dir = getDir player;
				_pos = player getRelPos [2.5, 0];
				_veh setDir _dir;
				if (getPosATL player select 2 > .2) then [{_pos set [2, getPosASL player select 2]; _veh setPosASL _pos},{_veh setPos _pos}];
				player moveInAny _veh;
			}, [], -1, false, true, "", "isNil 'Escape_use_act1' && {isNull objectParent player}"];
			waitUntil {sleep 1; !alive _ply || {_ply != player} || {!isNil "Escape_use_act1"}};
			_ply removeAction _idx;
			_ply removeAction _idx2;
			Escape_use_act1 = nil;
		};
	};
};
Escape_enemySW_code1 = {
	FAR_Enable = false;
	Escape_en_enemySW = false;
	//Escape_ply_enemy = [player,name player,_this];
	Escape_ply_enemy = player;
	if (!isNil "ES_Hang_up" && {!ES_Hang_up}) then {Player_Server = player; publicVariable "Player_Server"};
	if (isServer) then [{Escape_ply_enemy call Escape_PlayersEnemy},{profileNamespace setVariable ["ES_SAVE_KillNum",nil]; publicVariableServer "Escape_ply_enemy"}]; //
	if (getMarkerColor "Escape_greenCircle_mak" != "") then {deleteMarkerLocal "Escape_greenCircle_mak"; deleteMarkerLocal "Escape_greenCircle_mak2"};
	player addItem "acc_flashlight";
	sleep .2;
	if (isObjectHidden player) then {[player, false] remoteExec ["hideObjectGlobal", 2]};
	if (!simulationEnabled player) then {[player, true] remoteExec ["enableSimulationGlobal", 2]};
	_headlessClients = entities "HeadlessClient_F";
	private _Players = allPlayers - [_headlessClients, Player_Server, player] - Escape_Players_enemy;
	if (count _Players > 0 && {{player distance _x < 2000} count _Players == 0} && {!(vehicle player isKindOf "air") || {vehicle player isKindOf "ParachuteBase"} || {driver vehicle player != player}}) then {
		private ["_Players2","_ply","_pos","_para"];
		_para = createVehicle ['Steerable_Parachute_F', [0,0,888], [], 0, "NONE"];
		if (!isNull objectParent player) then {waitUntil {moveOut player; sleep .5; isNull objectParent player}};
		_Players2 = [];
		{if (alive _x && {isPlayer _x}) then {_Players2 pushback _x}} forEach _Players;
		if (count _Players2 == 0) then {_Players2 = _Players};
		_ply = selectRandom _Players2;
		_pos = _ply getPos [1200 + random 800, random 360];
		_pos set [2, 80 + random 220];
		_para setPos _pos;
		_para setDir (_para getDir _ply);
	    player moveInDriver _para;
		TitleText ["","BLACK IN"];
		if (isNil "minMapDis1" || {minMapDis1 != 1}) then {execVM "hud_map\minimap.sqf"};
	};
	call Escape_enemyAddAct;
	call Escape_fn_delay;
};
Escape_delay_time22 = 0;
Escape_en_enemySW = true;
close_combat_rating = -999999; ////
Escape_fn_enemySW = {
	Escape_delay_time = time + 30;
	if (!isNil "Escape_delay_var") exitWith {};
	if (Escape_Mutiny_en == 0 && {isNil "Escape_enemySW_side"}) exitWith {cutText ["服务器已关闭叛变功能！", "Plain"]};
	_players = call A3E_fnc_GetPlayers - [player, Player_Server] - Escape_Players_enemy;
	if ({alive _x && {_x distance A3E_StartPos > 500}} count _players == 0 && {isNil "Escape_enemySW_side"}) exitWith {cutText ["至少有一个人逃出监狱才能叛变！", "Plain"]};
	if (!Escape_en_enemySW) exitWith {cutText [Format["还需等待%1秒", Escape_delay_time22], "Plain"]};
	Escape_delay_var = 1;
	_check = false;
	Escape_cancelSW_enemy = false;
	waitUntil {
		_out = round (Escape_delay_time - time);
		[Format["<t color='#fff000'>倒计时准备%1秒</t>", abs _out],-1,.05 * safezoneH + safezoneY,3,0,0,33] spawn BIS_fnc_dynamicText;
		sleep 1;
		_check = (!alive player || {Escape_cancelSW_enemy} || {!(player getVariable ["FAR_once_eh", true])}); 
		_out <= 0 || {_check}
	};
	if _check exitWith {cutText ["取消", "Plain"]; Escape_delay_var = nil};
	_headlessClients = entities "HeadlessClient_F";
	_Players = allPlayers - [_headlessClients, Player_Server];
	if ({isPlayer _x} count Escape_Players_enemy >= floor(count _Players / Escape_Mutiny_num) && {isNil "Escape_enemySW_side"}) exitWith {cutText ["主线玩家人数少，不允许叛变！", "Plain"]; Escape_delay_var = nil};
	_units = [_this, _Players] call Escape_get_enemySW;
	Escape_delay_var = nil;
	if (count _units == 0) exitWith {cutText ["敌对玩家附近暂时没有可附体的敌军单位", "Plain"]};
	TitleText ["","BLACK OUT"];
	sleep 1;
	TitleText ["","BLACK IN"];
	waitUntil {alive player};
	_ai = selectRandom _units;
	if (!alive _ai) exitWith {cutText ["将要附体的AI死亡，操作无效！", "Plain"]};
	_headlessClients = entities "HeadlessClient_F";
	_Players = allPlayers - [_headlessClients, Player_Server];
	if ({isPlayer _x} count Escape_Players_enemy >= floor(count _Players / Escape_Mutiny_num) && {isNil "Escape_enemySW_side"}) exitWith {cutText ["主线玩家人数少，不允许叛变！", "Plain"]};
	_veh = vehicle _ai;
	if (_veh getVariable ["Escape_assets_control", false]) then {_veh setVariable ["Escape_assets_control", nil, true]; Escape_all_assets = Escape_all_assets - [_veh]; publicVariable "Escape_all_assets"}; //
	_ply = player;
	_score = _ply getVariable ["FAR_count_kill", 0];
	selectPlayer _ai;
	if (isNil "Escape_enemySW_side") then {
		_ply setDamage 1;
		//deleteVehicle _ply; //
		[format["%1 叛变成敌军", name player]] call drn_fnc_CL_ShowTitleTextAllClients;
	};
	Escape_enemySW_side = _this;
	player setVariable ["FAR_count_kill", _score, true];
	call Escape_enemySW_code1;
};
Escape_fn_enemySW2 = {
	_headlessClients = entities "HeadlessClient_F";
	_Players = allPlayers - [_headlessClients, Player_Server];
	_units = [Escape_enemySW_side, _Players] call Escape_get_enemySW;
	if (count _units == 0) exitWith {
		_center = getPosASL player;
		_pos = [_center, 999, 1999,3,0] call BIS_fnc_findSafePos;
		player setPos _pos;
		systemchat "没有可附体单位";
		call Escape_enemySW_code1;
	}; //
	_ai = selectRandom _units;
	if (!alive _ai) exitWith {call Escape_enemySW_code1};
	_veh = vehicle _ai;
	if (_veh getVariable ["Escape_assets_control", false]) then {_veh setVariable ["Escape_assets_control", nil, true]; Escape_all_assets = Escape_all_assets - [_veh]; publicVariable "Escape_all_assets"}; //
	_ply = player;
	_score = _ply getVariable ["FAR_count_kill", 0];
	selectPlayer _ai;
	deleteVehicle _ply;
	player setVariable ["FAR_count_kill", _score, true];
	call Escape_enemySW_code1;
};
Escape_fn_enemySW3 = {
	Escape_cancelSW_enemy = true;
	TitleText ["","BLACK OUT"];
	sleep 1;
	TitleText ["","BLACK IN"];
	if (!alive Escape_enemySW_unit) exitWith {cutText ["将要附体的AI死亡，操作无效！", "Plain"]};
	_score = player getVariable ["FAR_count_kill", 0];
	player setVariable ["FAR_onceEnemyPly", true]; //
	selectPlayer Escape_enemySW_unit;
	player setVariable ["FAR_count_kill", _score, true];
	if (!isNil "ES_Hang_up" && {!ES_Hang_up}) then {Player_Server = player; publicVariable "Player_Server"};
	Escape_ply_enemy = player;
	if (isServer) then [{Escape_ply_enemy call Escape_PlayersEnemy},{publicVariableServer "Escape_ply_enemy"}];
	player addItem "acc_flashlight";
	sleep .2;
	if (isObjectHidden player) then {[player, false] remoteExec ["hideObjectGlobal", 2]};
	if (!simulationEnabled player) then {[player, true] remoteExec ["enableSimulationGlobal", 2]};
	if (isNil "Escape_use_act2") then {call Escape_enemyAddAct};
};
Escape_enemySW_check = {
	private _target = cursorTarget;
	if (isNull _target) then {
		_nearUnits = nearestObjects [player, ["CaManBase"], 3] - [player];
		_target = if(count _nearUnits > 0)then[{_nearUnits select 0},{objNull}];
	};
	if (isNull _target || {!(_target isKindOf "CaManBase")} || {isPlayer _target} || {side _target != Escape_enemySW_side} || {_target distance player > 3} || {!alive _target} || {!alive player}) exitWith {false};
	Escape_enemySW_unit = _target;
	true
};
k1_sideColor = { //单位阵营默认HTML颜色代码
	if (_this isEqualTo west) exitWith {"#004C99"}; //蓝
	if (_this isEqualTo east) exitWith {"#800000"}; //红
	if (_this isEqualTo resistance) exitWith {"#008000"}; //绿
	if (_this isEqualTo civilian) exitWith {"#660080"}; //紫
	if (_this isEqualTo sideEnemy) exitWith {"#663380"}; //浅紫
	"#B29900" //深黄
};
Escape_Mutiny_nameList = {
	if ({isPlayer _x} count Escape_Players_enemy == 0) exitWith {cutText ["没有", "Plain"]};
	_str = "";
	_list = [];
	_html = "<t color='#00FFFF' size='.7' shadow='1' align='left'>" + "叛变名单/得分:" + "</t><br/><t size='.6' shadow='1' align='left' >"; //'#FF8c00'
	{if(isPlayer _x)then{_list pushback [_x getVariable ["FAR_count_kill", 0],name _x,(side group _x) call k1_sideColor]}} forEach Escape_Players_enemy;
	_list sort true; //玩家击倒排行
	{
		_x params ["_score", "_name", "_color"];
		_str = _str + format["<t color='%1'> %2: %3<br/>", _color,_name,_score];
	} forEach _list;
	_html = _html + _str +"<br/>" +"</t>"; 
	[_html,.232 + safeZoneX,.22 * safeZoneH + safeZoneY,20,1,0,73932] spawn BIS_fnc_dynamicText;
};
Escape_intelBox_debug = {
	_pos = if(_this)then[{Escape_intel_box},{Escape_intelBox_originalPos}];
	_houses = nearestObjects [_pos, ["house"], Escape_intel_Range];
	if (count _houses > 0) then [{
		_t = time + 5;
		while {true} do {
			_Bulding = selectRandom _houses;
			_Rooms = _Bulding buildingPos -1;
			_roomPos = selectRandom _Rooms;
			if (!isNil "_roomPos") exitWith {Escape_intel_box setPos _roomPos; ["重置情报位置到房屋"] call drn_fnc_CL_ShowTitleTextAllClients};
			if (time > _t) exitWith {Escape_intel_box setVehiclePosition [_pos, [], 5, "CAN_COLLIDE"]; ["重置情报位置"] call drn_fnc_CL_ShowTitleTextAllClients};
		};
	},{
		Escape_intel_box setVehiclePosition [_pos, [], 5, "CAN_COLLIDE"];
		["重置情报位置"] call drn_fnc_CL_ShowTitleTextAllClients;
	}];
};
Escape_vehWep_check = {
	private ["_role", "_turretPath", "_cargoIndex", "_veh", "_check"];
	_role = "";
	_turretPath = [];
	_cargoIndex = 0;
	_veh = vehicle _this;
	_check = false;
	if (_veh getVariable ["Escape_vehWep_Used", false]) exitWith {_check};
	{if (_x select 0 == _this) exitWith {_role = _x select 1; _turretPath = _x select 3; _cargoIndex = _x select 2}} forEach fullCrew _veh;
	if ((toLower _role in ["turret","gunner","commander"] && {_cargoIndex == -1} && {count(_veh weaponsTurret _turretPath) != 0}) || {_veh isKindOf "air" && {_role == "driver"} && {currentWeapon _veh != ""}}) then {_check = true};
	_check
};
Escape_cas_mak = {
	params ["_idx","_pos","_str","_name"];
	_make = createMarkerLocal [format["CAS_%1", _idx], _pos];
	_make setMarkerTypeLocal "hd_objective";
	_make setMarkerSizeLocal [.8,.8];
	_make setMarkerTextLocal format ["%1 [%2]", _str,_name];
	_make setMarkerColorLocal "ColorRed";
	sleep 30;
	deleteMarkerLocal _make;
};
Escape_fn_addCommMenuItem = {
	params ["_unit", "_item"];
	[_unit, _item] call BIS_fnc_addCommMenuItem;
};
kk_fn_UnitTrait = {
	waitUntil {!isNull player};
	{player setUnitTrait [_x, true]} forEach ["Medic", "engineer", "explosiveSpecialist", "UAVHacker"];
	player createDiarySubject ["PlayerUnitTrait", "兵种技能"];
	player createDiaryRecord ["PlayerUnitTrait", ["说明", "<br/>玩家拥有: 医护兵，工兵，爆破兵，UAV兵的兵种技能<br/><br/>- 带医疗包能在满血治疗和救治时不消耗黄包（有黑包不用带黄包）<br/>- 带工具包可以快速维修所有载具<br/>"]]
};
Escape_fn_getCas = {
	if (!isNil "Escape_enemySW_side") exitWith {["<t color='#fff000' size = '.8'>叛变人员不可用！</t>",-1,.25 * safezoneH + safezoneY,5,0,0,33] spawn BIS_fnc_dynamicText};
	_killNum = player getVariable ["Escape_Kill_num", 0];
	if (_killNum >= Escape_casKill_num) then [{
		_num = _killNum - Escape_casKill_num;
		player setVariable ["Escape_Kill_num", _num, true];
		call Escape_killNum_show;
		_sel = selectRandom [4,5]; //机炮和导弹有问题
		_str = switch _sel do {
			case 1: {"近空支援 [机炮]"};
			case 2: {"近空支援 [导弹]"};
			case 3: {"近空支援 [机炮和导弹]"};
			case 4: {"近空支援 [炸弹]"};
			case 5: {"火炮支援"};
		};
		[player, format["kk_Escape_airStrike_%1", _sel]] call BIS_fnc_addCommMenuItem;
		[format["<t color='#fff000'>换取: %1 -%2人 剩余: %3人</t>", _str,Escape_casKill_num,_num],-1,.05 * safezoneH + safezoneY,8,0,0,33] spawn BIS_fnc_dynamicText;
	},{
		[format["<t color='#fff000'>杀敌人数不够 还需: %1人</t>", Escape_casKill_num - _killNum],-1,.05 * safezoneH + safezoneY,8,0,0,33] spawn BIS_fnc_dynamicText;
	}];
};
if (Escape_vehKill_1 == 3) then {
	(getAssetDLCInfo ["O_T_LSV_02_unarmed_F"]) params ["_isDlc","_isOwned","","","","_DLCName"];
	if (_isDlc && {!_isOwned}) then {Escape_vehKill_1 = 1};
}; //
Escape_vehKill_class = switch Escape_vehKill_1 do {
	case 0: {Escape_vehKill_str = "四轮摩托"; "C_Quadbike_01_F"};
	case 1: {Escape_vehKill_str = "越野车"; "C_Offroad_01_F"};
	case 2: {Escape_vehKill_str = "SUV"; "C_SUV_01_F"};
	case 3: {Escape_vehKill_str = "麒麟"; "O_T_LSV_02_unarmed_F"};
	case 4: {Escape_vehKill_str = "直升机"; "C_Heli_Light_01_civil_F"};
};
Escape_fn_getVeh = {
	if (!isNil "Escape_enemySW_side") exitWith {["<t color='#fff000' size = '.8'>叛变人员不可用！</t>",-1,.25 * safezoneH + safezoneY,5,0,0,33] spawn BIS_fnc_dynamicText};
	_killNum = player getVariable ["Escape_Kill_num", 0];
	if (_killNum >= Escape_vehKill_num1) then [{
		if (!isNull objectParent player) exitWith {["<t color='#fff000' size = '.8'>你必须在载具外！</t>",-1,.25 * safezoneH + safezoneY,5,0,0,33] spawn BIS_fnc_dynamicText};
		_num = _killNum - Escape_vehKill_num1;
		player setVariable ["Escape_Kill_num", _num, true];
		call Escape_killNum_show;
		_str = "";
		_class = if(_this == 0)then[{_str = Escape_vehKill_str; Escape_vehKill_class},{_str = "摩托艇"; "C_Scooter_Transport_01_F"}];
		[format["<t color='#fff000'>换取: %1 -%2人 剩余: %3人</t>", _str,Escape_vehKill_num1,_num],-1,.05 * safezoneH + safezoneY,8,0,0,33] spawn BIS_fnc_dynamicText;
		_veh = createVehicle [_class, [0,0,999], [], 0, "CAN_COLLIDE"];
		_dir = getDir player;
		_pos = player getRelPos [3, 0];
		_veh setDir _dir;
		player allowDamage false; //
		if (getPosATL player select 2 > .2) then [{_pos set [2, getPosASL player select 2]; _veh setPosASL _pos},{_veh setPos _pos}];
		player moveInAny _veh;
		player allowDamage true;
	},{
		[format["<t color='#fff000'>杀敌人数不够 还需: %1人</t>", Escape_vehKill_num1 - _killNum],-1,.05 * safezoneH + safezoneY,8,0,0,33] spawn BIS_fnc_dynamicText;
	}];
};
Escape_isBike = isClass (configFile  >> "CfgPatches" >> "CAWheeled2_MMT");
Escape_isBike2 = isClass (configFile  >> "CfgVehicles" >> "vn_c_bicycle_01");
if (Escape_bikeKill_2 == 4) then {
	(getAssetDLCInfo ["O_T_LSV_02_unarmed_F"]) params ["_isDlc","_isOwned"];
	if (_isDlc && {!_isOwned}) then {Escape_bikeKill_2 = 2};
}; //
Escape_bikeKill_class = switch Escape_bikeKill_2 do {
	case 0: {Escape_bikeKill_str = "自行车"; if(Escape_isBike)then[{"MMT_Civ_1"},{"vn_c_bicycle_01"}]};
	case 1: {Escape_bikeKill_str = "四轮摩托"; "C_Quadbike_01_F"};
	case 2: {Escape_bikeKill_str = "越野车"; "C_Offroad_01_F"};
	case 3: {Escape_bikeKill_str = "SUV"; "C_SUV_01_F"};
	case 4: {Escape_bikeKill_str = "麒麟"; "O_T_LSV_02_unarmed_F"};
	case 5: {Escape_bikeKill_str = "直升机"; "C_Heli_Light_01_civil_F"};
};
Escape_fn_getBike = {
	if (!isNil "Escape_enemySW_side") exitWith {["<t color='#fff000' size = '.8'>叛变人员不可用！</t>",-1,.25 * safezoneH + safezoneY,5,0,0,33] spawn BIS_fnc_dynamicText};
	_killNum = player getVariable ["Escape_Kill_num", 0];
	if (_killNum >= Escape_bikeKill_num) then [{
		if (!isNull objectParent player) exitWith {["<t color='#fff000' size = '.8'>你必须在载具外！</t>",-1,.25 * safezoneH + safezoneY,5,0,0,33] spawn BIS_fnc_dynamicText};
		if (Escape_bikeKill_2 == 0 && {!Escape_isBike} && {!Escape_isBike2}) exitWith {["<t color='#fff000' size = '.8'>无法创建自行车! 打开地图用帮助选项下载模组.</t>",-1,.25 * safezoneH + safezoneY,10,0,0,33] spawn BIS_fnc_dynamicText};
		_num = _killNum - Escape_bikeKill_num;
		player setVariable ["Escape_Kill_num", _num, true];
		call Escape_killNum_show;
		[format["<t color='#fff000'>换取: %1 -%2人 剩余: %3人</t>", Escape_bikeKill_str,Escape_bikeKill_num,_num],-1,.05 * safezoneH + safezoneY,8,0,0,33] spawn BIS_fnc_dynamicText;
		_bike = createVehicle [Escape_bikeKill_class, [0,0,999], [], 0, "CAN_COLLIDE"];
		_dir = getDir player;
		_pos = player getRelPos [3, 0];
		_bike setDir _dir;
		player allowDamage false;
		if (getPosATL player select 2 > .2) then [{_pos set [2, getPosASL player select 2]; _bike setPosASL _pos},{_bike setPos _pos}];
		player moveInAny _bike;
		player allowDamage true;
		if (Escape_bikeKill_2 == 0 && {Escape_isBike}) then {_bike setMass 30}; //
	},{
		[format["<t color='#fff000'>杀敌人数不够 还需: %1人</t>", Escape_bikeKill_num - _killNum],-1,.05 * safezoneH + safezoneY,8,0,0,33] spawn BIS_fnc_dynamicText;
	}];
};
Escape_fn_getReconUAV = {
	if (!isNil "Escape_enemySW_side") exitWith {["<t color='#fff000' size = '.8'>叛变人员不可用！</t>",-1,.25 * safezoneH + safezoneY,5,0,0,33] spawn BIS_fnc_dynamicText};
	if (isNil "A3E_Task_Map_Complete" || {!A3E_Task_Map_Complete}) exitWith {["<t color='#fff000' size = '.8'>需要完成找到地图任务才可用！</t>",-1,.25 * safezoneH + safezoneY,5,0,0,33] spawn BIS_fnc_dynamicText};
	_killNum = player getVariable ["Escape_Kill_num", 0];
	if (_killNum >= Escape_reconUAV_num) then [{
		private ["_class", "_side", "_terminal"];
		_num = _killNum - Escape_reconUAV_num;
		player setVariable ["Escape_Kill_num", _num, true];
		call Escape_killNum_show;
		[format["<t color='#fff000'>换取: 无人机 -%1人 剩余: %2人</t>", Escape_reconUAV_num,_num],-1,.05 * safezoneH + safezoneY,8,0,0,33] spawn BIS_fnc_dynamicText;
		_class = if(A3E_VAR_Side_Blufor == west)then[{_side = west; _terminal = "B_UavTerminal"; "B_UAV_01_F"},{_side = east; _terminal = "O_UavTerminal"; "O_UAV_01_F"}];
		_pos = getPosASL player;
		_arr = [_pos, 0, _class, _side] call BIS_fnc_spawnVehicle; //
		_uav = _arr select 0;
		_grp = _arr select 2;
		_h = (getPosATL player select 2) + 500;
		_pos set [2, _h];
		_uav setPosATL _pos;
		_uav flyInHeight _h;
		_wp = _grp addWaypoint [player, 0];
		_wp setWaypointType "LOITER";
		_wp setWaypointLoiterType "CIRCLE_L";
		_wp setWaypointLoiterRadius 500;
		player linkItem _terminal;
		player connectTerminalToUAV _uav;
		player action ["UAVTerminalOpen", player];
	},{
		[format["<t color='#fff000'>杀敌人数不够 还需: %1人</t>", Escape_reconUAV_num - _killNum],-1,.05 * safezoneH + safezoneY,8,0,0,33] spawn BIS_fnc_dynamicText;
	}];
};
Righting_Bike_Check = {
	_veh = vehicle player;
	if (_veh isKindOf "Motorcycle" && {(vectorUp _veh) select 2 < .6 || {getPos _veh select 2 < -.3}} && {getPos _veh select 2 < 5} && {alive _veh}) exitWith {true};
	false
};
Escape_fn_suicide = {
	Escape_suicide_delay = time + 60;
	if (!isNil "Escape_suicide_var") exitWith {};
	Escape_suicide_var = 1;
	_check = false;
	Escape_suicide_cancel = false;
	_key = (findDisplay 46) displayAddEventHandler ["KeyDown", {if(_this select 1 == 45)then{Escape_suicide_cancel = true; true}}];
	systemchat "按X键放弃自杀";
	waitUntil {
		_out = round (Escape_suicide_delay - time);
		[Format["<t color='#fff000'>自杀倒计时%1秒</t>", abs _out],-1,.05 * safezoneH + safezoneY,3,0,0,33] spawn BIS_fnc_dynamicText;
		sleep 1;
		_check = (!alive player || {Escape_suicide_cancel}); 
		_out <= 0 || {_check}
	};
	Escape_suicide_var = nil;
	(findDisplay 46) displayRemoveEventHandler ["KeyDown", _key];
	if (_check) exitWith {systemchat "放弃自杀"};
	player setDamage 1;
};
Escape_fn_greenCircleClick = {
	if (!isNil "Escape_greenCircleClick") exitWith {};
	if (!isNil "Escape_ply_greenCircle") exitWith {cutText ["关闭后才能重新设置绿圈！", "Plain"]};
	Escape_greenCircleClick = 1;
	cutText ["点击地图设置绿圈中心", "Plain"];
	onMapSingleClick {
		onMapSingleClick "";
		Escape_greenCircle_radius = _pos call Escape_fnc_plyDisMax;
		if (Escape_greenCircle_radius < 100) then {Escape_greenCircle_radius = 100};
		publicVariable "Escape_greenCircle_radius";
		Escape_greenCircle_pos = _pos;
		publicVariable "Escape_greenCircle_pos";
		Escape_ply_greenCircle = 1;
		publicVariable "Escape_ply_greenCircle";
		if (isServer) then {0 spawn Escape_greenCircle_sv};
	};
	_t = time + 30;
	waitUntil {!isNil "Escape_ply_greenCircle" || {!visibleMap} || {time > _t}};
	if (isNil "Escape_ply_greenCircle") then {onMapSingleClick ""; cutText ["取消设置绿圈", "Plain"]};
	Escape_greenCircleClick = nil;
};
Escape_greenCircle_Kill = {
	if (isNil "Escape_enemySW_side") then {
		private _mak = "Escape_greenCircle_mak";
		if (alive player && {!(getPosASL player inArea _mak)} && {!(player getVariable ["FAR_is_killFriend", false])} && {player != Player_Server} && {getMarkerColor _mak != ""}) then {player setDamage 1; cutText ["你在绿圈外被杀死！", "Plain"]};
		if (getMarkerColor _mak != "") then {_mak setMarkerSizeLocal [Escape_greenCircle_radius, Escape_greenCircle_radius]};
	};
};
Escape_greenCircle2_Kill = {
	if (isNil "Escape_enemySW_side") then {
		private _mak = "Escape_greenCircle2_mak";
		if (alive player && {!(getPosASL player inArea _mak)} && {!(player getVariable ["FAR_is_killFriend", false])} && {player != Player_Server} && {getMarkerColor _mak != ""}) then {player setDamage 1; cutText ["你在绿圈外被杀死！", "Plain"]};
	};
};
Escape_fn_KillNum = {
	params ["_unit", "_isPlayer"];
	if (_unit == player) then {
		_killNum = player getVariable ["Escape_Kill_num", 0];
		if (_killNum == 0) exitWith {};
		_num = if(_isPlayer)then[{Escape_ReviveKill_num / 2},{Escape_ReviveKill_num}];
		_num2 = _killNum - _num;
		if (_num2 < 0) then {_num2 = 0};
		player setVariable ["Escape_Kill_num", _num2, true];
		[format["<t color='#ff0000' size = '.8'>治疗-%1个杀敌人数</t>", _num],-1,.25 * safezoneH + safezoneY,8,0,0,33] spawn BIS_fnc_dynamicText;
		systemchat format["治疗-%1个杀敌人数", _num];
		call Escape_killNum_show;
	};
};
Escape_killNum_list = {
	if (!isNil "Escape_enemySW_side") exitWith {};
	_str = "";
	_list = [];
	_html = "<t color='#FF8c00' size='.7' shadow='1' align='left'>" + "杀敌人数:" + "</t><br/><t size='.6' shadow='1' align='left' >";
	{if(isPlayer _x)then{_list pushback [_x getVariable ["Escape_Kill_num",0],name _x]}} forEach (allPlayers - [entities "HeadlessClient_F"] - Escape_Players_enemy);
	_list sort false;
	{
		_x params ["_score", "_name"];
		_str = _str + format[" %1: %2<br/>", _name,_score];
	} forEach _list;
	_html = _html + "<t color='#00FFFF' size='.6' shadow='0' shadowColor='#312100' align='left' >" + _str +"<br/>" +"</t>"; 
	[_html,.232 + safeZoneX,.22 * safeZoneH + safeZoneY,20,1,0,73932] spawn BIS_fnc_dynamicText;
};
Escape_killNum_show = {
	[format["<t color='#FFFFFF' size='.5' align='right'>杀敌: %1</t>", player getVariable ["Escape_Kill_num",0]],.9 + safeZoneX,.975 * safeZoneH + safeZoneY,999999,0,0,3569] spawn BIS_fnc_dynamicText;
};
Escape_extVeh_mak = {
	_mak = "Escape_extVehSel_mak";
	deleteMarkerLocal _mak;
	_vdn = getText (configFile >> "CfgVehicles" >> typeOf Escape_extVeh_sel >> "displayName");
	sleep .1;
	_mak = createMarkerLocal [_mak, getPosASL Escape_extVeh_sel];
	_mak setMarkerTypeLocal "hd_dot";
	_mak setMarkerSizeLocal [.4,.4];
	_mak setMarkerColorLocal "ColorWhite";
	_mak setMarkerTextLocal (format['%1号载具 [%2]',_this,_vdn]);
	_t = time + 15;
	waitUntil {time > _t || {getMarkerColor _mak == ""}};
	deleteMarkerLocal _mak;
};
Escape_fn_buyMedical = {
	if (!isNil "Escape_enemySW_side") exitWith {["<t color='#fff000' size = '.8'>叛变人员不可用！</t>",-1,.25 * safezoneH + safezoneY,5,0,0,33] spawn BIS_fnc_dynamicText};
	if (player getVariable ["FAR_isUnconscious",0] == 0) exitWith {["<t color='#fff000' size = '.8'>倒下才可用！</t>",-1,.25 * safezoneH + safezoneY,5,0,0,33] spawn BIS_fnc_dynamicText};
	_killNum = player getVariable ["Escape_Kill_num", 0];
	if (_killNum >= Escape_buyMedical_num) then [{
		_num = _killNum - Escape_buyMedical_num;
		player setVariable ["Escape_Kill_num", _num, true];
		call Escape_killNum_show;
		[format["<t color='#fff000'>换取: 医护兵 -%1人 剩余: %2人 请按H键呼叫医治</t>", Escape_buyMedical_num,_num],-1,.05 * safezoneH + safezoneY,8,0,0,33] spawn BIS_fnc_dynamicText;
		_relPos = [player, random 3 - 3, getDir player] call BIS_fnc_relPos;
		_grp = createGroup [civilian, true];
		_unit = objNull;
		"C_Man_Paramedic_01_F" createUnit [_relPos, _grp, "_unit = this; if(isServer)then{_unit spawn {sleep 300; _this setDamage 1}};", .5, "PRIVATE"];
		removeAllAssignedItems _unit;
		_h = getPosASL player select 2;
		_relPos set [2, _h + .2];
		_unit setPosASL _relPos;
		_unit allowFleeing 0;
		_unit setVariable ["FAR_SIDE_Medic", true, true];
		{_unit disableAI _x} forEach ["TARGET","AUTOTARGET"];
		if (_num < Escape_ReviveKill_num && {isNull (player getVariable ["FAR_call_AI",objNull])}) then {
			_side = player getVariable ["FAR_unit_Side", side player];
			[_unit, player, _side, false] remoteExec ["FAR_doMove_Revive", _unit];
		};
	},{
		[format["<t color='#fff000'>杀敌人数不够 还需: %1人</t>", Escape_buyMedical_num - _killNum],-1,.05 * safezoneH + safezoneY,8,0,0,33] spawn BIS_fnc_dynamicText;
	}];
};
Righting_wep_Check = {
	_return = false;
	righting_tag = cursorTarget;
	if (righting_tag isKindOf "StaticWeapon" && {righting_tag distance player < 5} && {(vectorUp righting_tag) select 2 < .6 || {getPos righting_tag select 2 < -.3}} && {alive righting_tag} && {vehicle player == player}) then {_return = true};
	_return
};
Righting_wep_Check2 = {
	_return = false;
	righting_tag = cursorTarget;
	if (righting_tag isKindOf "StaticWeapon" && {righting_tag distance player < 5} && {alive righting_tag} && {count crew righting_tag == 0} && {vehicle player == player}) then {_return = true};
	_return
};
Righting_wep_dir = {
	_obj = righting_tag;
    _dir = if(_this)then[{(getDir _obj) + 22.5},{(getDir _obj) - 22.5}];
	_obj setDir _dir;
	_obj setPosASL getPosASL _obj;
};
MoveOut_Dead_Check = {
	_return = false;
	private _target = cursorTarget;
	if (!isNull _target && {_target distance player < 8} && {stance player == "STAND"} && {alive _target} && {vehicle player == player} && {_target isKindOf "LandVehicle" || {_target isKindOf "air"} || {_target isKindOf "Ship"} || {_target isKindOf "StaticWeapon"}} && {({!alive _x} count (crew _target)) > 0}) then { _return = true };
	_return
};
k1_PushAside_Check = {
	_objs = [];
	{ if((_x isKindOf "man" && {!alive _x}) || {getText (configFile >> "CfgVehicles" >> typeOf _x >> "displayName") in ["地面","Ground"]} || {_x isKindOf "weaponHolder"})then{_objs pushBack _x} } forEach (nearestObjects [player, [], 1.6, true] - [player]);
	PushAside_obj = if(count _objs > 0)then[{_objs select 0},{objNull}];
	if (!isNull PushAside_obj && {PushAside_obj distance player < 1.6 || {PushAside_obj distance2D player < 1.6 && {getPos PushAside_obj select 2 < -.1}}} && {isNull objectParent player}) exitWith {true};
	false
};
Escape_fn_killAI2 = {
	remoteExec ["Escape_getVar1", 2];
	systemChat "等待服务器发送据点位置...";
	_t = time + 20;
	waitUntil {!isNil "Escape_StrongholdPosArr" || {time > _t}};
	if (isNil "Escape_StrongholdPosArr") exitwith {systemChat "获取据点位置失败"};
	private ["_Players","_c"];
	_c = 0;
	_Players = allPlayers - [entities "HeadlessClient_F"];
	params ["_dis1", "_dis2"];
	{
		_ai = _x;
		if (alive _ai && {!isPlayer _ai} && {_ai isKindOf "CaManBase"} && {!(vehicle _x isKindOf "air")} && {!(vehicle _x isKindOf "Ship")} && {{_ai distance _x < _dis1} count _Players == 0} && {{_ai distance _x < _dis2} count Escape_StrongholdPosArr == 0}) then {vehicle _x setDamage 1; _c = _c + 1};
	} forEach allUnits;
	Escape_StrongholdPosArr = nil;
	format["清理%1米外AI: %2个", _dis1,_c] remoteExec ["systemchat", 0];
};
Escape_fn_getGiveKillNum = {
	params ["_give", "_name"];
	_killNum = player getVariable ["Escape_Kill_num", 0];
	_killNum = _killNum + _give;
	player setVariable ["Escape_Kill_num", _killNum, true];
	call Escape_killNum_show;
	call Escape_killNum_list;
	remoteExec ["Escape_killNum_list", remoteExecutedOwner];
	format["%1 把%2个杀敌数给 %3", _name,_give,name player] remoteExec ["systemchat", 0];
};
Escape_fn_giveKillNum = {
	_target = cursorTarget;
	if (!(_target isKindOf "CaManBase") || {_target distance player > 5} || {!isPlayer _target} || {!(_target in (allPlayers - [entities "HeadlessClient_F",player] - Escape_Players_enemy))}) exitwith {systemChat "操作无效"};
	_killNum = player getVariable ["Escape_Kill_num", 0];
	if (_killNum < _this) exitwith {["<t color='#fff000'>杀敌数不够！</t>",-1,.05 * safezoneH + safezoneY,8,0,0,33] spawn BIS_fnc_dynamicText};
	_killNum = _killNum - _this;
	player setVariable ["Escape_Kill_num", _killNum, true];
	call Escape_killNum_show;
	[format["<t color='#fff000'>杀敌数 -%1</t>", _this],-1,.05 * safezoneH + safezoneY,8,0,0,33] spawn BIS_fnc_dynamicText;
	[_this,name player] remoteExec ["Escape_fn_getGiveKillNum", _target];
};
Sacks_delete_Check = {
	_return = false;
	private _target = cursorTarget;
	if (isNull _target) then {
		_nearObjs = nearestObjects [player, [], 2] - [player];
		_target = if(count _nearObjs > 0)then[{_nearObjs select 0},{objNull}];
	};
	if (!isNull _target && {_target distance player < 8} && {_target in Sacks_blindage_arr} && {isNull objectParent player}) then {_return = true; sacks_del_tag = _target};
	_return
};
Sacks_blindage_pv = compile preprocessFileLineNumbers "kk\Sacks_blindage.sqf";
headshot_script = {_this setVariable ["Headshot_killHead2", true]};

"Escape_KillNum_pv" addPublicVariableEventHandler {(_this select 1) call Escape_fn_KillNum};

waitUntil {!isNull player}; ////////////////////////

addMissionEventHandler ["EntityKilled", {
	params ["_killed", "_killer", "_instigator"];
	if ((_killer == player || {_instigator == player} || {vehicle _killer == getConnectedUAV player} || {_killer == vehicle player && {isNull _instigator}}) && {_killed isKindOf "CAManBase"} && {_killed != player}) then {
		_killedSideID = getNumber (configFile >> "CfgVehicles" >> typeOf _killed >> "side");
		if (isNil "Escape_enemySW_side") then [{
			_sideID = A3E_VAR_Side_Blufor call BIS_fnc_sideID;
			_killNum = player getVariable ["Escape_Kill_num", 0];
			_killNum = if(_killedSideID in [_sideID,3])then[{[format["<t color='#ff0000' size = '.8'>杀平民友军-%1个杀敌人数！</t>", Escape_FriendKill_num],-1,.25 * safezoneH + safezoneY,8,0,0,33] spawn BIS_fnc_dynamicText; systemchat format["杀平民友军-%1个杀敌人数！", Escape_FriendKill_num]; _killNum - Escape_FriendKill_num},{_killed spawn {_t = time + 5; waitUntil {!isNil {_this getVariable "Headshot_killHead2"} || {time > _t}}; if(_this getVariable ["Headshot_killHead2",false])then{_this setVariable ["Headshot_killHead2", nil]; sleep .2; _s = selectRandom [.5,1,.5]; player globalChat format["爆头击杀: +%1", _s]; _killNum = player getVariable ["Escape_Kill_num", 0]; player setVariable ["Escape_Kill_num", _killNum + _s, true]; call Escape_killNum_show}}; _killNum + 1}];
			if (_killNum < 0) then {_killNum = 0};
			player setVariable ["Escape_Kill_num", _killNum, true];
			call Escape_killNum_show;
		},{
			_sideID = Escape_enemySW_side call BIS_fnc_sideID;
			if (_killedSideID == _sideID || {(A3E_VAR_Side_Opfor getFriend A3E_VAR_Side_Ind >= .6) && {A3E_VAR_Side_Ind getFriend A3E_VAR_Side_Opfor >= .6} && {_killedSideID == 2}}) then {player addRating -999999; systemchat "评分 -999999！"};
		}];
	};
}];

call Escape_killNum_show;

if(Escape_icons == 1)then{[] execVM "kk\icons.sqf"};
if(Escape_Fatigue == 1)then{[] execVM "kk\Fatigue.sqf"};
0 spawn compile preprocessFileLineNumbers "kk\Escape_MOD.sqf";
if(Escape_tags == 1)then{0 spawn compile preprocessFileLineNumbers "kk\tags.sqf"};

if(Escape_KillHint == 1)then{0 spawn compile preprocessFileLineNumbers "kk\KillHint.sqf"}; //击杀反馈
if(Escape_otherUnif == 1)then{[] execVM "kk\otherUnif.sqf"}; //解除衣服限制
if(Escape_jump == 1)then{[] execVM "kk\jump.sqf"}; //长按C键跳跃


Escape_link = {
	["<a href='http://bbs.3dmgame.com/thread-5789089-1-1.html'>下载新版本</a>","链接", false, true] spawn BIS_fnc_guiMessage;
};
Escape_link2 = {
	["<a href='https://bbs.3dmgame.com/thread-6167321-1-1.html'>打开网页</a>","链接", false, true] spawn BIS_fnc_guiMessage;
};
Escape_fn_option2 = {
	if (player getVariable ["Escape_option2", true]) then {
		player setVariable ["Escape_option2", false];
		player createDiarySubject ["Escape_Menu","帮助"];
		player createDiaryRecord ["Escape_Menu", ["支援", format["<br/>主线玩家杀敌达到一定数量后可以用滚轮菜单换取支援奖励.<br/>如果是未购买的DLC载具将用其他载具替换.<br/><execute expression = 'systemChat str Escape_casKill_num;'>火力支援需要杀敌</execute>  <execute expression = 'systemChat str Escape_vehKill_num1;'>%1/摩托艇需要杀敌</execute>  <execute expression = 'systemChat str Escape_bikeKill_num;'>%2需要杀敌</execute>  <execute expression = 'systemChat str Escape_reconUAV_num;'>无人机需要杀敌</execute>  <execute expression = 'systemChat str Escape_buyMedical_num;'>医护兵需要杀敌</execute>  <execute expression = 'systemchat (""需要杀敌"" + str Escape_ReviveKill_num + "", 玩家评分"" + str rating player);'>消除负面影响需要杀敌</execute>  <execute expression = 'systemchat (""平民救治-"" + str Escape_ReviveKill_num + "", 玩家救治-"" + str (Escape_ReviveKill_num/2));'>医疗救治减杀敌人数</execute>  <execute expression = 'call Escape_killNum_list;'>杀敌人数</execute>  <execute expression = 'call Escape_fn_getCas;'>换取火力支援</execute>  <execute expression = '0 spawn Escape_fn_buyMedical;'>换取医护兵</execute><br/>", Escape_vehKill_str,Escape_bikeKill_str]]];
		player createDiaryRecord ["Escape_Menu", ["敌人与绿军关系", "<br/><execute expression = '_str = if(A3E_VAR_Side_Opfor getFriend A3E_VAR_Side_Ind < .6 and {A3E_VAR_Side_Ind getFriend A3E_VAR_Side_Opfor < .6})then[{""敌对""},{""友好""}]; systemchat _str;'>查看</execute><br/>"]];
		player createDiaryRecord ["Escape_Menu", ["滤镜夜视仪", "<br/><execute expression = 'if (Escape_NVG_en == 0) then [{systemchat ""此功能已禁用""},{execVM ""kk\NVG.sqf""}];'>切换夜视模式</execute>  <execute expression = 'if (!isNil ""NVG_Effect_K1"") then {nvMode_k1 = 2; execVM ""kk\NVG.sqf""};'>关闭</execute><br/>"]];
		player createDiaryRecord ["Escape_Menu", ["主线任务", "<br/>任务流程: 逃出监狱 - 找到地图 - 进入敌人据点来减少未确定的情报位置并找到情报箱子 - 拿情报箱子到通讯站入侵数据终端 - 全部主线玩家到撤离点撤离.<br/><br/>情报会随机刷在最后一个据点红圈内的某个建筑物中.<br/><br/>必须防止敌人把情报带出地图边界，那样任务会直接失败.<br/><br/>注意情报箱子会暴露你们所在区域，有叛变玩家时更不能在一个地方待太久.<br/><br/>不要杀平民！屠杀平民会招来更多敌人.<br/>"]];
		player createDiaryRecord ["Escape_Menu", ["叛变", "<br/>你将附体到敌对玩家附近的敌人身上，除了死亡重生每5分钟可以切换一次切换时有30秒延迟，也可以靠近AI友军用鼠标滚轮切换到AI身上。叛变后你要阻止敌对玩家拿到情报箱子，阻止他们拿去通信终端上传，阻止他们逃脱，敌人的失败就是你的胜利.<br/><br/>叛变后鼠标滚轮有个小地图选项，打开后在右下角显示小地图.<br/><br/>叛变的玩家能拿取据点的武器，除了直接附体到受限的载具据点的载具和固定武器要看服务器是否开放使用，如果是禁用当主线玩家靠近后就永久解除限制了.<br/><br/>如果服务器禁用载具武器和固定武器，你需要从主线玩家手里抢夺才能使用.<br/><br/>叛变玩家会随机附体到主线玩家1公里外到2公里内的敌人AI身上，超出2公里会进行空降.<br/><br/>如果服务器'战争模式'开启需要注意另一阵营AI敌人会攻击你，这时候你要面对主线玩家和敌对AI这两个阵营.<br/><br/>多个玩家叛变到不同阵营只能用公共频道交流了，最好叛变在同一个阵营.<br/><br/>要留意主线玩家入侵一个据点时的位置以及情报位置刷新动态，也许你能抢在他们前面找到情报.<br/><br/>你需要等待倒计时走完才能拿走情报，被主线玩家拿起会重新计时.<br/><br/>把情报拿出地图边界红圈外可以结束任务.<br/>"]];
		player createDiaryRecord ["Escape_Menu", ["重生", "<br/>主线玩家死亡会随机重生到队友身边或者进入没满人的载具里，用按键能切换重生到队友远处在敌人守尸体时应该很有用.<br/>"]];
		player createDiaryRecord ["Escape_Menu", ["下载自行车模组", "<br/><execute expression = 'call Escape_link2'>链接</execute>     或者加群下载210036089<br/>"]];
		player createDiaryRecord ["Escape_Menu", ["下载任务图", "<br/><execute expression = 'call Escape_link'>链接</execute>     或者加群下载210036089<br/>"]];
		
		///////////////////////////////////////
		
		player createDiarySubject ["Escape_Menu2", "叛变成敌军"];
		player createDiaryRecord ["Escape_Menu2", ["切换到敌军", "<br/>你将附体到敌对玩家附近的敌人身上，除了死亡重生每5分钟可以切换一次，切换时有30秒延迟。叛变后你要阻止敌对玩家拿到情报箱子，阻止他们拿去通信终端上传，阻止他们逃脱，敌人的失败就是我们的胜利。<br/><br/><execute expression = 'call Escape_Mutiny_nameList;'>叛变名单</execute>  <execute expression = 'west spawn Escape_fn_enemySW;'>加入蓝方</execute>  <execute expression = 'resistance spawn Escape_fn_enemySW;'>加入绿方</execute>  <execute expression = 'Escape_cancelSW_enemy = true;'>取消</execute><br/>"]]; //
	};
};
Escape_fn_option = {
	if ((isServer || {serverCommandAvailable "#kick"}) && {player getVariable ["Escape_option", true]}) then {
		player setVariable ["Escape_option", false];
		player createDiarySubject ["Escape__option", "任务管理"];
		player createDiaryRecord ["Escape__option", ["任务参数修改", "<br/>----- FAR医疗模组设置 -----<br/>FAR医疗系统:<br/><execute expression = 'FAR_Enable = false; publicVariable ""FAR_Enable""; [""FAR医疗: 禁用""] call drn_fnc_CL_ShowTitleTextAllClients; systemChat ""禁用"";'>禁用</execute>  <execute expression = 'FAR_Enable = true; publicVariable ""FAR_Enable""; [""FAR医疗: 启用""] call drn_fnc_CL_ShowTitleTextAllClients; systemChat ""启用"";'>启用（默认）</execute><br/>治疗与止血模式:<br/>模式0: 老版本一直用的，不支持设置救人和止血时间<br/>模式1: 可以显示和保持救人进度，可设置救人时间但不能趴下救人<br/>模式2: 长按动作选项救治，可设置时间可任何姿势救人但不能保持进度<br/><execute expression = 'FAR_actMode = 0; publicVariable ""FAR_actMode""; systemChat ""模式0"";'>模式0</execute>  <execute expression = 'FAR_actMode = 1; publicVariable ""FAR_actMode""; systemChat ""模式1"";'>模式1</execute>  <execute expression = 'FAR_actMode = 2; publicVariable ""FAR_actMode""; systemChat ""模式2"";'>模式2</execute><br/>医治时间:<br/><execute expression = 'FAR_reviveTime = 6; publicVariable ""FAR_reviveTime""; systemChat ""6秒"";'>6秒</execute>  <execute expression = 'FAR_reviveTime = 10; publicVariable ""FAR_reviveTime""; systemChat ""10秒"";'>10秒</execute>  <execute expression = 'FAR_reviveTime = 15; publicVariable ""FAR_reviveTime""; systemChat ""15秒"";'>15秒</execute>  <execute expression = 'FAR_reviveTime = 20; publicVariable ""FAR_reviveTime""; systemChat ""20秒"";'>20秒</execute>  <execute expression = 'FAR_reviveTime = 30; publicVariable ""FAR_reviveTime""; systemChat ""30秒"";'>30秒</execute>  <execute expression = 'FAR_reviveTime = 60; publicVariable ""FAR_reviveTime""; systemChat ""60秒"";'>60秒</execute>  <execute expression = 'FAR_reviveTime = 90; publicVariable ""FAR_reviveTime""; systemChat ""90秒"";'>90秒</execute><br/>止血时间:<br/><execute expression = 'FAR_StabilizeTime = 5; publicVariable ""FAR_StabilizeTime""; systemChat ""5秒"";'>5秒</execute>  <execute expression = 'FAR_StabilizeTime = 7; publicVariable ""FAR_StabilizeTime""; systemChat ""7秒"";'>7秒</execute>  <execute expression = 'FAR_StabilizeTime = 10; publicVariable ""FAR_StabilizeTime""; systemChat ""10秒"";'>10秒</execute>  <execute expression = 'FAR_StabilizeTime = 15; publicVariable ""FAR_StabilizeTime""; systemChat ""15秒"";'>15秒</execute>  <execute expression = 'FAR_StabilizeTime = 20; publicVariable ""FAR_StabilizeTime""; systemChat ""20秒"";'>20秒</execute>  <execute expression = 'FAR_StabilizeTime = 45; publicVariable ""FAR_StabilizeTime""; systemChat ""45秒"";'>45秒</execute>  <execute expression = 'FAR_StabilizeTime = 70; publicVariable ""FAR_StabilizeTime""; systemChat ""70秒"";'>70秒</execute><br/>重生删除玩家尸体:<br/><execute expression = 'FAR_Remove_body = true; publicVariable ""FAR_Remove_body""; systemChat ""是"";'>是</execute>  <execute expression = 'FAR_Remove_body = false; publicVariable ""FAR_Remove_body""; systemChat ""否"";'>否（默认）</execute><br/>爬动会被敌人攻击:<br/><execute expression = 'FAR_shot_creep = true; publicVariable ""FAR_shot_creep""; systemChat ""是"";'>是（默认）</execute>  <execute expression = 'FAR_shot_creep = false; publicVariable ""FAR_shot_creep""; systemChat ""否"";'>否</execute><br/>倒下是无敌:<br/><execute expression = 'FAR_Invincible = true; publicVariable ""FAR_Invincible""; [""倒下的玩家打不死""] call drn_fnc_CL_ShowTitleTextAllClients; systemChat ""是"";'>是（默认）</execute>  <execute expression = 'FAR_Invincible = false; publicVariable ""FAR_Invincible""; [""倒下的玩家可以被打死""] call drn_fnc_CL_ShowTitleTextAllClients; systemChat ""否"";'>否</execute><br/><br/>----- 玩家全部倒下则任务失败 -----<br/><execute expression = 'allow_FailTasks = 1; publicVariable ""allow_FailTasks""; systemChat ""是"";'>是</execute>  <execute expression = 'allow_FailTasks = 0; publicVariable ""allow_FailTasks""; systemChat ""否"";'>否</execute><br/><br/>----- 战争模式（敌人和绿军敌对） -----<br/><execute expression = '_str = if(isNil ""A3E_use_RHS"")then[{0 remoteExec [""A3E_setFriend_kk"", 2]; [""敌人和绿军敌对（减AI数量）""] call drn_fnc_CL_ShowTitleTextAllClients; ""是""},{""使用红锤无法设置""}]; systemChat _str;'>是（难度降低）</execute>  <execute expression = '1 remoteExec [""A3E_setFriend_kk"", 2]; [""敌人和绿军友好""] call drn_fnc_CL_ShowTitleTextAllClients; systemChat ""否"";'>否（难度提高）</execute<br/>"]];
		
		player createDiaryRecord ["Escape__option", ["内部参数修改", "<br/>----- 允许玩家叛变 -----<br/><execute expression = 'Escape_Mutiny_en = 1; publicVariable ""Escape_Mutiny_en""; systemChat ""是"";'>是（默认）</execute>  <execute expression = 'Escape_Mutiny_en = 0; publicVariable ""Escape_Mutiny_en""; systemChat ""否"";'>否</execute><br/><br/>----- 每多少个玩家才允许一个叛变 -----<br/><execute expression = 'Escape_Mutiny_num = 3; publicVariable ""Escape_Mutiny_num""; systemChat ""3个"";'>3个</execute>  <execute expression = 'Escape_Mutiny_num = 5; publicVariable ""Escape_Mutiny_num""; systemChat ""5个"";'>5个</execute>  <execute expression = 'Escape_Mutiny_num = 6; publicVariable ""Escape_Mutiny_num""; systemChat ""6个"";'>6个</execute>  <execute expression = 'Escape_Mutiny_num = 7; publicVariable ""Escape_Mutiny_num""; systemChat ""7个"";'>7个</execute>  <execute expression = 'Escape_Mutiny_num = 8; publicVariable ""Escape_Mutiny_num""; systemChat ""8个"";'>8个</execute>  <execute expression = 'Escape_Mutiny_num = 10; publicVariable ""Escape_Mutiny_num""; systemChat ""10个"";'>10个</execute>  <execute expression = 'Escape_Mutiny_num = 15; publicVariable ""Escape_Mutiny_num""; systemChat ""15个"";'>15个</execute><br/><br/>----- 叛变玩家不能使用据点载具和武器 -----<br/>主线玩家靠近后会解除限制<br/><execute expression = 'Escape_MutinyUseAssets = 1; publicVariable ""Escape_MutinyUseAssets""; systemChat ""是"";'>是（默认）</execute>  <execute expression = 'Escape_MutinyUseAssets = 0; publicVariable ""Escape_MutinyUseAssets""; systemChat ""否"";'>否</execute><br/><br/>----- 叛变玩家不能使用载具武器和固定武器 -----<br/><execute expression = 'Escape_MutinyUseWep = 1; publicVariable ""Escape_MutinyUseWep""; systemChat ""是"";'>是（默认）</execute>  <execute expression = 'Escape_MutinyUseWep = 0; publicVariable ""Escape_MutinyUseWep""; systemChat ""否"";'>否</execute><br/><br/>----- 进入据点最多去掉多少情报无效标记 -----<br/><execute expression = 'Escape_intelMaks_null = 3; publicVariable ""Escape_intelMaks_null""; systemChat ""3个"";'>3个（默认）</execute>  <execute expression = 'Escape_intelMaks_null = 4; publicVariable ""Escape_intelMaks_null""; systemChat ""4个"";'>4个</execute>  <execute expression = 'Escape_intelMaks_null = 5; publicVariable ""Escape_intelMaks_null""; systemChat ""5个"";'>5个</execute>  <execute expression = 'Escape_intelMaks_null = 6; publicVariable ""Escape_intelMaks_null""; systemChat ""6个"";'>6个</execute>  <execute expression = 'Escape_intelMaks_null = 7; publicVariable ""Escape_intelMaks_null""; systemChat ""7个"";'>7个</execute>  <execute expression = 'Escape_intelMaks_null = 8; publicVariable ""Escape_intelMaks_null""; systemChat ""8个"";'>8个</execute><br/><br/>----- 叛徒玩家要多久才能拿起主线玩家放下的情报 -----<br/><execute expression = 'Escape_intelTake_time = 300; publicVariable ""Escape_intelTake_time""; systemChat ""5分钟"";'>5分钟</execute>  <execute expression = 'Escape_intelTake_time = 600; publicVariable ""Escape_intelTake_time""; systemChat ""10分钟"";'>10分钟</execute>  <execute expression = 'Escape_intelTake_time = 900; publicVariable ""Escape_intelTake_time""; systemChat ""15分钟"";'>15分钟</execute>  <execute expression = 'Escape_intelTake_time = 1200; publicVariable ""Escape_intelTake_time""; systemChat ""20分钟"";'>20分钟（默认）</execute>  <execute expression = 'Escape_intelTake_time = 1800; publicVariable ""Escape_intelTake_time""; systemChat ""30分钟"";'>30分钟</execute>  <execute expression = 'Escape_intelTake_time = 3600; publicVariable ""Escape_intelTake_time""; systemChat ""1小时"";'>1小时</execute><br/><br/>----- 主线玩家用武装载具会刷出空中载具追杀的概率 -----<br/><execute expression = 'Escape_air_killerProbability = 0; publicVariable ""Escape_air_killerProbability""; systemChat ""0%"";'>0%</execute>  <execute expression = 'Escape_air_killerProbability = 10; publicVariable ""Escape_air_killerProbability""; systemChat ""10%"";'>10%</execute>  <execute expression = 'Escape_air_killerProbability = 20; publicVariable ""Escape_air_killerProbability""; systemChat ""20%"";'>20%</execute>  <execute expression = 'Escape_air_killerProbability = 30; publicVariable ""Escape_air_killerProbability""; systemChat ""30%"";'>30%（默认）</execute>  <execute expression = 'Escape_air_killerProbability = 50; publicVariable ""Escape_air_killerProbability""; systemChat ""50%"";'>50%</execute>  <execute expression = 'Escape_air_killerProbability = 65; publicVariable ""Escape_air_killerProbability""; systemChat ""65%"";'>65%</execute>  <execute expression = 'Escape_air_killerProbability = 80; publicVariable ""Escape_air_killerProbability""; systemChat ""80%"";'>80%</execute>  <execute expression = 'Escape_air_killerProbability = 100; publicVariable ""Escape_air_killerProbability""; systemChat ""100%"";'>100%</execute><br/><br/>----- 敌方旋翼无人机会自爆 -----<br/><execute expression = 'Escape_uavKiller = 1; publicVariable ""Escape_uavKiller""; systemChat ""是"";'>是（默认）</execute>  <execute expression = 'Escape_uavKiller = 0; publicVariable ""Escape_uavKiller""; systemChat ""否"";'>否</execute>  <execute expression = '_str = if(Escape_uavKiller_smoker == 0)then[{Escape_uavKiller_smoker = 1; ""有红色烟雾""},{Escape_uavKiller_smoker = 0; ""无红色烟雾""}]; publicVariable ""Escape_uavKiller_smoker""; systemChat _str;'>拉烟</execute>  <execute expression = 'Escape_uavKiller_probability = 10; publicVariable ""Escape_uavKiller_probability""; systemChat ""10%"";'>组装无人机概率: 10%</execute>  <execute expression = 'Escape_uavKiller_probability = 20; publicVariable ""Escape_uavKiller_probability""; systemChat ""20%"";'>20%</execute>  <execute expression = 'Escape_uavKiller_probability = 30; publicVariable ""Escape_uavKiller_probability""; systemChat ""30%"";'>30%</execute>  <execute expression = 'Escape_uavKiller_probability = 50; publicVariable ""Escape_uavKiller_probability""; systemChat ""50%"";'>50%</execute>  <execute expression = 'Escape_uavKiller_probability = 65; publicVariable ""Escape_uavKiller_probability""; systemChat ""65%"";'>65%（默认）</execute>  <execute expression = 'Escape_uavKiller_probability = 80; publicVariable ""Escape_uavKiller_probability""; systemChat ""80%"";'>80%</execute>  <execute expression = 'Escape_uavKiller_probability = 100; publicVariable ""Escape_uavKiller_probability""; systemChat ""100%"";'>100%</execute><br/>"]];
		
		/*player createDiaryRecord ["Escape__option", ["玩家额外技能", "<br/>让一个玩家拥有多个兵种的技能<br/><execute expression = 'if (kk_setUnitTrait == 0 and {isNil ""kk_setUnitTrait2""}) then [{kk_setUnitTrait2 = 1; publicVariable ""kk_setUnitTrait2""; remoteExec [""kk_fn_UnitTrait"", 0, true]; systemChat ""启用""},{systemChat ""已经启用""}];'>启用</execute><br/>"]];*/
		player createDiaryRecord ["Escape__option", ["滤镜夜视仪", "<br/>用鼠标滚轮打开，拥有全屏效果<br/><execute expression = 'if (Escape_NVG_en == 0) then [{Escape_NVG_en = 1; publicVariable ""Escape_NVG_en""; systemChat ""启用""},{Escape_NVG_en = 0; publicVariable ""Escape_NVG_en""; systemChat ""禁用""}];'>启用/禁用</execute><br/>"]];
		player createDiaryRecord ["Escape__option", ["支援", format["<br/>----- 杀敌多少能换取火力支援 -----<br/><execute expression = 'Escape_casKill_num = 10; publicVariable ""Escape_casKill_num""; systemChat ""10人"";'>10人</execute>  <execute expression = 'Escape_casKill_num = 15; publicVariable ""Escape_casKill_num""; systemChat ""15人"";'>15人</execute>  <execute expression = 'Escape_casKill_num = 20; publicVariable ""Escape_casKill_num""; systemChat ""20人"";'>20人（默认）</execute>  <execute expression = 'Escape_casKill_num = 30; publicVariable ""Escape_casKill_num""; systemChat ""30人"";'>30人</execute>  <execute expression = 'Escape_casKill_num = 40; publicVariable ""Escape_casKill_num""; systemChat ""40人"";'>40人</execute>  <execute expression = 'Escape_casKill_num = 50; publicVariable ""Escape_casKill_num""; systemChat ""50人"";'>50人</execute>  <execute expression = 'Escape_casKill_num = 999; publicVariable ""Escape_casKill_num""; systemChat ""999人"";'>999人</execute><br/><br/>----- 杀敌多少能换取%1/摩托艇 -----<br/><execute expression = 'Escape_vehKill_num1 = 7; publicVariable ""Escape_vehKill_num1""; systemChat ""7人"";'>7人</execute>  <execute expression = 'Escape_vehKill_num1 = 10; publicVariable ""Escape_vehKill_num1""; systemChat ""10人"";'>10人</execute>  <execute expression = 'Escape_vehKill_num1 = 15; publicVariable ""Escape_vehKill_num1""; systemChat ""15人"";'>15人</execute>  <execute expression = 'Escape_vehKill_num1 = 20; publicVariable ""Escape_vehKill_num1""; systemChat ""20人"";'>20人</execute>  <execute expression = 'Escape_vehKill_num1 = 25; publicVariable ""Escape_vehKill_num1""; systemChat ""25人"";'>25人</execute>  <execute expression = 'Escape_vehKill_num1 = 35; publicVariable ""Escape_vehKill_num1""; systemChat ""35人"";'>35人</execute>  <execute expression = 'Escape_vehKill_num1 = 45; publicVariable ""Escape_vehKill_num1""; systemChat ""45人"";'>45人</execute>  <execute expression = 'Escape_vehKill_num1 = 55; publicVariable ""Escape_vehKill_num1""; systemChat ""55人"";'>55人</execute>  <execute expression = 'Escape_vehKill_num1 = 999; publicVariable ""Escape_vehKill_num1""; systemChat ""999人"";'>999人</execute><br/><br/>----- 杀敌多少能换取%2 -----<br/><execute expression = 'Escape_bikeKill_num = 3.5; publicVariable ""Escape_bikeKill_num""; systemChat ""3.5人"";'>3.5人</execute>  <execute expression = 'Escape_bikeKill_num = 5; publicVariable ""Escape_bikeKill_num""; systemChat ""5人"";'>5人</execute>  <execute expression = 'Escape_bikeKill_num = 10; publicVariable ""Escape_bikeKill_num""; systemChat ""10人"";'>10人</execute>  <execute expression = 'Escape_bikeKill_num = 15; publicVariable ""Escape_bikeKill_num""; systemChat ""15人"";'>15人</execute>  <execute expression = 'Escape_bikeKill_num = 20; publicVariable ""Escape_bikeKill_num""; systemChat ""20人"";'>20人</execute>  <execute expression = 'Escape_bikeKill_num = 25; publicVariable ""Escape_bikeKill_num""; systemChat ""25人"";'>25人</execute>  <execute expression = 'Escape_bikeKill_num = 30; publicVariable ""Escape_bikeKill_num""; systemChat ""30人"";'>30人</execute>  <execute expression = 'Escape_bikeKill_num = 40; publicVariable ""Escape_bikeKill_num""; systemChat ""40人"";'>40人</execute>  <execute expression = 'Escape_bikeKill_num = 50; publicVariable ""Escape_bikeKill_num""; systemChat ""50人"";'>50人</execute>  <execute expression = 'Escape_bikeKill_num = 999; publicVariable ""Escape_bikeKill_num""; systemChat ""999人"";'>999人</execute><br/><br/>----- 杀敌多少能换取无人机 -----<br/><execute expression = 'Escape_reconUAV_num = 5; publicVariable ""Escape_reconUAV_num""; systemChat ""5人"";'>5人</execute>  <execute expression = 'Escape_reconUAV_num = 10; publicVariable ""Escape_reconUAV_num""; systemChat ""10人"";'>10人（默认）</execute>  <execute expression = 'Escape_reconUAV_num = 15; publicVariable ""Escape_reconUAV_num""; systemChat ""15人"";'>15人</execute>  <execute expression = 'Escape_reconUAV_num = 20; publicVariable ""Escape_reconUAV_num""; systemChat ""20人"";'>20人</execute>  <execute expression = 'Escape_reconUAV_num = 30; publicVariable ""Escape_reconUAV_num""; systemChat ""30人"";'>30人</execute>  <execute expression = 'Escape_reconUAV_num = 40; publicVariable ""Escape_reconUAV_num""; systemChat ""40人"";'>40人</execute>  <execute expression = 'Escape_reconUAV_num = 50; publicVariable ""Escape_reconUAV_num""; systemChat ""50人"";'>50人</execute>  <execute expression = 'Escape_reconUAV_num = 999; publicVariable ""Escape_reconUAV_num""; systemChat ""999人"";'>999人</execute><br/><br/>----- 杀平民和友军减杀敌人数 -----<br/><execute expression = 'Escape_FriendKill_num = 2; publicVariable ""Escape_FriendKill_num""; systemChat ""2人"";'>2人</execute>  <execute expression = 'Escape_FriendKill_num = 3; publicVariable ""Escape_FriendKill_num""; systemChat ""3人"";'>3人</execute>  <execute expression = 'Escape_FriendKill_num = 5; publicVariable ""Escape_FriendKill_num""; systemChat ""5人"";'>5人（默认）</execute>  <execute expression = 'Escape_FriendKill_num = 6; publicVariable ""Escape_FriendKill_num""; systemChat ""6人"";'>6人</execute>  <execute expression = 'Escape_FriendKill_num = 7; publicVariable ""Escape_FriendKill_num""; systemChat ""7人"";'>7人</execute>  <execute expression = 'Escape_FriendKill_num = 8; publicVariable ""Escape_FriendKill_num""; systemChat ""8人"";'>8人</execute>  <execute expression = 'Escape_FriendKill_num = 10; publicVariable ""Escape_FriendKill_num""; systemChat ""10人"";'>10人</execute>  <execute expression = 'Escape_FriendKill_num = 15; publicVariable ""Escape_FriendKill_num""; systemChat ""15人"";'>15人</execute>  <execute expression = 'Escape_FriendKill_num = 20; publicVariable ""Escape_FriendKill_num""; systemChat ""20人"";'>20人</execute>  <execute expression = 'Escape_FriendKill_num = 30; publicVariable ""Escape_FriendKill_num""; systemChat ""30人"";'>30人</execute><br/><br/>----- 医治和重生消耗杀敌人数 -----<br/><execute expression = 'Escape_ReviveKill_num = 2; publicVariable ""Escape_ReviveKill_num""; systemChat ""2人"";'>2人</execute>  <execute expression = 'Escape_ReviveKill_num = 3; publicVariable ""Escape_ReviveKill_num""; systemChat ""3人"";'>3人（默认）</execute>  <execute expression = 'Escape_ReviveKill_num = 5; publicVariable ""Escape_ReviveKill_num""; systemChat ""5人"";'>5人</execute>  <execute expression = 'Escape_ReviveKill_num = 6; publicVariable ""Escape_ReviveKill_num""; systemChat ""6人"";'>6人</execute>  <execute expression = 'Escape_ReviveKill_num = 7; publicVariable ""Escape_ReviveKill_num""; systemChat ""7人"";'>7人</execute>  <execute expression = 'Escape_ReviveKill_num = 8; publicVariable ""Escape_ReviveKill_num""; systemChat ""8人"";'>8人</execute>  <execute expression = 'Escape_ReviveKill_num = 10; publicVariable ""Escape_ReviveKill_num""; systemChat ""10人"";'>10人</execute>  <execute expression = 'Escape_ReviveKill_num = 15; publicVariable ""Escape_ReviveKill_num""; systemChat ""15人"";'>15人</execute>  <execute expression = 'Escape_ReviveKill_num = 20; publicVariable ""Escape_ReviveKill_num""; systemChat ""20人"";'>20人</execute>  <execute expression = 'Escape_ReviveKill_num = 30; publicVariable ""Escape_ReviveKill_num""; systemChat ""30人"";'>30人</execute><br/><br/>----- 换取医护兵消耗杀敌人数 -----<br/><execute expression = 'Escape_buyMedical_num = 2; publicVariable ""Escape_buyMedical_num""; systemChat ""2人"";'>2人</execute>  <execute expression = 'Escape_buyMedical_num = 3; publicVariable ""Escape_buyMedical_num""; systemChat ""3人"";'>3人</execute>  <execute expression = 'Escape_buyMedical_num = 5; publicVariable ""Escape_buyMedical_num""; systemChat ""5人"";'>5人（默认）</execute>  <execute expression = 'Escape_buyMedical_num = 6; publicVariable ""Escape_buyMedical_num""; systemChat ""6人"";'>6人</execute>  <execute expression = 'Escape_buyMedical_num = 7; publicVariable ""Escape_buyMedical_num""; systemChat ""7人"";'>7人</execute>  <execute expression = 'Escape_buyMedical_num = 8; publicVariable ""Escape_buyMedical_num""; systemChat ""8人"";'>8人</execute>  <execute expression = 'Escape_buyMedical_num = 10; publicVariable ""Escape_buyMedical_num""; systemChat ""10人"";'>10人</execute>  <execute expression = 'Escape_buyMedical_num = 15; publicVariable ""Escape_buyMedical_num""; systemChat ""15人"";'>15人</execute>  <execute expression = 'Escape_buyMedical_num = 20; publicVariable ""Escape_buyMedical_num""; systemChat ""20人"";'>20人</execute>  <execute expression = 'Escape_buyMedical_num = 30; publicVariable ""Escape_buyMedical_num""; systemChat ""30人"";'>30人</execute>  <execute expression = 'Escape_buyMedical_num = 999; publicVariable ""Escape_buyMedical_num""; systemChat ""999人"";'>999人</execute><br/>", Escape_vehKill_str,Escape_bikeKill_str]]];
		player createDiaryRecord ["Escape__option", ["浓雾天气", "<br/><execute expression = 'if (isNil ""kk_fog_loop"") then {kk_fog_mass = true; publicVariable ""kk_fog_mass""; ""kk\kk_fog.sqf"" remoteExec [""execVM"",0]}; systemChat ""开启"";'>开启</execute>  <execute expression = 'kk_fog_mass = false; publicVariable ""kk_fog_mass""; systemChat ""关闭"";'>关闭</execute><br/>"]];
		player createDiaryRecord ["Escape__option", ["加速夜晚时间", "<br/><execute expression = 'Escape_TimeMultiplier_night = 1; publicVariable ""Escape_TimeMultiplier_night""; systemChat ""启用"";'>启用</execute>  <execute expression = 'Escape_TimeMultiplier_night = 0; publicVariable ""Escape_TimeMultiplier_night""; systemChat ""禁用"";'>禁用</execute><br/>"]];
		player createDiaryRecord ["Escape__option", ["强制玩家集合", "<br/>点击地图创建一个绿圈，每分钟减掉设定的半径，主线玩家不再圈内将被杀死<br/><execute expression = '0 spawn Escape_fn_greenCircleClick;'>开启</execute>  <execute expression = 'Escape_ply_greenCircle = nil; publicVariable ""Escape_ply_greenCircle""; systemChat ""关闭"";'>关闭</execute><br/><br/>----- 每分钟缩小多少米 -----<br/><execute expression = 'Escape_greenCircle_reduce = 100; publicVariable ""Escape_greenCircle_reduce""; systemChat ""100米"";'>100米</execute>  <execute expression = 'Escape_greenCircle_reduce = 200; publicVariable ""Escape_greenCircle_reduce""; systemChat ""200米"";'>200米（默认）</execute>  <execute expression = 'Escape_greenCircle_reduce = 300; publicVariable ""Escape_greenCircle_reduce""; systemChat ""300米"";'>300米</execute>  <execute expression = 'Escape_greenCircle_reduce = 400; publicVariable ""Escape_greenCircle_reduce""; systemChat ""400米"";'>400米</execute>  <execute expression = 'Escape_greenCircle_reduce = 500; publicVariable ""Escape_greenCircle_reduce""; systemChat ""500米"";'>500米</execute>  <execute expression = 'Escape_greenCircle_reduce = 999; publicVariable ""Escape_greenCircle_reduce""; systemChat ""999米"";'>999米</execute>  <execute expression = 'Escape_greenCircle_reduce = 3000; publicVariable ""Escape_greenCircle_reduce""; systemChat ""3000米"";'>3000米</execute>  <execute expression = 'Escape_greenCircle_reduce = 5000; publicVariable ""Escape_greenCircle_reduce""; systemChat ""5000米"";'>5000米</execute>  <execute expression = 'Escape_greenCircle_reduce = 999999; publicVariable ""Escape_greenCircle_reduce""; systemChat ""999999米"";'>999999米</execute><br/>"]];
		player createDiaryRecord ["Escape__option", ["强制撤离点集合", "<br/>撤离点丢烟后开始缩圈强制玩家集合<br/><br/><execute expression = 'Escape_ShrinkRing = 1; publicVariable ""Escape_ShrinkRing""; systemChat ""启用"";'>启用</execute>  <execute expression = 'Escape_ShrinkRing = 2; publicVariable ""Escape_ShrinkRing""; systemChat ""在前往标记缩圈"";'>在前往标记缩圈</execute>  <execute expression = 'Escape_ShrinkRing = 0; publicVariable ""Escape_ShrinkRing""; systemChat ""禁用"";'>禁用</execute><br/>"]];
		player createDiaryRecord ["Escape__option", ["撤离载具控制", "<br/><execute expression = '_str = if(isNil{Escape_extVeh1}||{!alive Escape_extVeh1})then[{""选择无效""},{Escape_extVeh_sel = Escape_extVeh1; 1 spawn Escape_extVeh_mak; ""选择1号载具""}]; systemchat _str;'>1号载具</execute>  <execute expression = '_str = if(isNil{Escape_extVeh2}||{!alive Escape_extVeh2})then[{""选择无效""},{Escape_extVeh_sel = Escape_extVeh2; 2 spawn Escape_extVeh_mak; ""选择2号载具""}]; systemchat _str;'>2号载具</execute>  <execute expression = '_str = if(isNil{Escape_extVeh3}||{!alive Escape_extVeh3})then[{""选择无效""},{Escape_extVeh_sel = Escape_extVeh3; 3 spawn Escape_extVeh_mak; ""选择3号载具""}]; systemchat _str;'>3号载具</execute><br/><br/><execute expression = '0 execVM ""kk\heliTransport.sqf""'>载具前往</execute>  <execute expression = '1 execVM ""kk\heliTransport.sqf""'>直升机着陆</execute>  <execute expression = '2 execVM ""kk\heliTransport.sqf""'>清除载具路径点</execute>  <execute expression = '3 execVM ""kk\heliTransport.sqf""'>强制降落（机组离开载具）</execute><br/><br/><execute expression = 'heliTrans_land_mode = ""LAND""; systemchat ""“LAND”"";'>“LAND（关发动机）”</execute>  <execute expression = 'heliTrans_land_mode = ""GET IN""; systemchat ""“GET IN”"";'>“GET IN”</execute><br/><br/>飞行高度<br/><execute expression = 'heliTrans_fly_h = 50; systemchat ""50米"";'>50米（默认）</execute>  <execute expression = 'heliTrans_fly_h = 100; systemchat ""100米"";'>100米</execute>  <execute expression = 'heliTrans_fly_h = 200; systemchat ""200米"";'>200米</execute>  <execute expression = 'heliTrans_fly_h = 300; systemchat ""300米"";'>300米</execute>  <execute expression = 'heliTrans_fly_h = 500; systemchat ""500米"";'>500米</execute>  <execute expression = 'heliTrans_fly_h = 800; systemchat ""800米"";'>800米</execute>  <execute expression = 'heliTrans_fly_h = 999; systemchat ""999米"";'>999米</execute>  <execute expression = 'heliTrans_fly_h = 1500; systemchat ""1500米"";'>1500米</execute><br/>"]];
		player createDiaryRecord ["Escape__option", ["杀死远处的AI（人数管控）", "<br/>杀死离玩家和据点一定距离外的AI单位<br/>不对空中单位和水面船只进行清理<br/>建议在AI数量暴增任务对人数管控失效影响帧率时使用<br/>不建议频繁使用有可能会打乱任务的刷兵机制<br/>服务器也已经在每隔15分钟自动清除2000米的了<br/><execute expression = '_str = if(isNil ""Escape_killAILocal"")then[{Escape_killAILocal = 1; ""本机执行""},{Escape_killAILocal = nil; ""服务器执行""}]; systemchat _str;'>服务器/本机执行</execute><br/><execute expression = 'if (isNil ""Escape_killAILocal"") then [{[2000,300] remoteExec [""Escape_fn_killAI"", 2]},{[2000,300] spawn Escape_fn_killAI2}]; systemChat ""执行！(2000,300)"";'>执行 (2000,300)</execute>  <execute expression = 'if (isNil ""Escape_killAILocal"") then [{[1000,150] remoteExec [""Escape_fn_killAI"", 2]},{[1000,150] spawn Escape_fn_killAI2}]; systemChat ""执行！(1000,150)"";'>执行 (1000,150)</execute>  <execute expression = 'if (isNil ""Escape_killAILocal"") then [{[800,150] remoteExec [""Escape_fn_killAI"", 2]},{[800,150] spawn Escape_fn_killAI2}]; systemChat ""执行！(800,150)"";'>执行 (800,150)</execute>  <execute expression = 'if (isNil ""Escape_killAILocal"") then [{[700,150] remoteExec [""Escape_fn_killAI"", 2]},{[700,150] spawn Escape_fn_killAI2}]; systemChat ""执行！(700,150)"";'>执行 (700,150)</execute>  <execute expression = 'if (isNil ""Escape_killAILocal"") then [{[600,150] remoteExec [""Escape_fn_killAI"", 2]},{[600,150] spawn Escape_fn_killAI2}]; systemChat ""执行！(600,150)"";'>执行 (600,150)</execute>  <execute expression = 'if (isNil ""Escape_killAILocal"") then [{[500,150] remoteExec [""Escape_fn_killAI"", 2]},{[500,150] spawn Escape_fn_killAI2}]; systemChat ""执行！"";'>执行 (500,150)</execute>  <execute expression = 'if (isNil ""Escape_killAILocal"") then [{[300,150] remoteExec [""Escape_fn_killAI"", 2]},{[300,150] spawn Escape_fn_killAI2}]; systemChat ""执行！(300,150)"";'>执行 (300,150)</execute><br/><br/>----- AI数量超出自动清理（间隔5分钟[500,150]） -----<br/><execute expression = 'Escape_AI_numMAX = 100; publicVariable ""Escape_AI_numMAX""; systemChat ""100"";'>100</execute>  <execute expression = 'Escape_AI_numMAX = 150; publicVariable ""Escape_AI_numMAX""; systemChat ""150"";'>150</execute>  <execute expression = 'Escape_AI_numMAX = 200; publicVariable ""Escape_AI_numMAX""; systemChat ""200"";'>200（默认）</execute>  <execute expression = 'Escape_AI_numMAX = 300; publicVariable ""Escape_AI_numMAX""; systemChat ""300"";'>300</execute>  <execute expression = 'Escape_AI_numMAX = 400; publicVariable ""Escape_AI_numMAX""; systemChat ""400"";'>400</execute>  <execute expression = 'Escape_AI_numMAX = 500; publicVariable ""Escape_AI_numMAX""; systemChat ""500"";'>500</execute>  <execute expression = 'Escape_AI_numMAX = 600; publicVariable ""Escape_AI_numMAX""; systemChat ""600"";'>600</execute><br/>"]];
		player createDiaryRecord ["Escape__option", ["删除尸体", "<br/>删除玩家多少米之外的尸体<br/><execute expression = '_str = if(isNil ""CorpseRecycledLocal"")then[{CorpseRecycledLocal = 1; ""本机执行""},{CorpseRecycledLocal = nil; ""服务器执行""}]; systemchat _str;'>服务器/本机执行</execute><br/><execute expression = 'if (isNil ""CorpseRecycledLocal"") then [{5 remoteExec [""corpseRd_delDead"",2]},{5 spawn corpseRd_delDead}]; systemchat ""删除5米"";'>删除5米</execute>  <execute expression = 'if (isNil ""CorpseRecycledLocal"") then [{10 remoteExec [""corpseRd_delDead"",2]},{10 spawn corpseRd_delDead}]; systemchat ""删除10米"";'>删除10米</execute>  <execute expression = 'if (isNil ""CorpseRecycledLocal"") then [{20 remoteExec [""corpseRd_delDead"",2]},{20 spawn corpseRd_delDead}]; systemchat ""删除20米"";'>删除20米</execute>  <execute expression = 'if (isNil ""CorpseRecycledLocal"") then [{30 remoteExec [""corpseRd_delDead"",2]},{30 spawn corpseRd_delDead}]; systemchat ""删除30米"";'>删除30米</execute>  <execute expression = 'if (isNil ""CorpseRecycledLocal"") then [{50 remoteExec [""corpseRd_delDead"",2]},{50 spawn corpseRd_delDead}]; systemchat ""删除50米"";'>删除50米</execute>  <execute expression = 'if (isNil ""CorpseRecycledLocal"") then [{450 remoteExec [""corpseRd_delDead"",2]},{450 spawn corpseRd_delDead}]; systemchat ""删除450米"";'>删除450米</execute><br/>"]];
		player createDiaryRecord ["Escape__option", ["情报箱子位置除错", "<br/><execute expression = 'if (isNull Escape_intel_box) then [{systemchat ""手提箱无效""},{true call Escape_intelBox_debug}];'>在原地重置</execute>  <execute expression = 'if (isNull Escape_intel_box) then [{systemchat ""手提箱无效""},{false call Escape_intelBox_debug}];'>在初始位置重置</execute><br/>"]];
		player createDiaryRecord ["Escape__option", ["重生有手枪有地图", "<br/>完成找到地图任务重生才有地图<br/><execute expression = 'Escape_RespawnWep = 1; publicVariable ""Escape_RespawnWep""; systemchat ""是"";'>是</execute>  <execute expression = 'Escape_RespawnWep = 0; publicVariable ""Escape_RespawnWep""; systemchat ""否"";'>否（默认）</execute><br/>"]];
		player createDiaryRecord ["Escape__option", ["重生有夜视仪", "<br/><execute expression = 'Escape_RS_NVG = 1; publicVariable ""Escape_RS_NVG""; systemchat ""是"";'>是</execute>  <execute expression = 'Escape_RS_NVG = 0; publicVariable ""Escape_RS_NVG""; systemchat ""否"";'>否（默认）</execute><br/>"]];
		player createDiaryRecord ["Escape__option", ["重生时间", "<br/><execute expression = '[3] remoteExec [""setPlayerRespawnTime"", 0]; Escape_respawn_time = 3; publicVariable ""Escape_respawn_time""; systemChat ""3秒"";'>3秒</execute>  <execute expression = '[15] remoteExec [""setPlayerRespawnTime"", 0]; Escape_respawn_time = 15; publicVariable ""Escape_respawn_time""; systemChat ""15秒"";'>15秒</execute>  <execute expression = '[30] remoteExec [""setPlayerRespawnTime"", 0]; Escape_respawn_time = 30; publicVariable ""Escape_respawn_time""; systemChat ""30秒"";'>30秒（默认）</execute>  <execute expression = '[45] remoteExec [""setPlayerRespawnTime"", 0]; Escape_respawn_time = 45; publicVariable ""Escape_respawn_time""; systemChat ""45秒"";'>45秒</execute>  <execute expression = '[60] remoteExec [""setPlayerRespawnTime"", 0]; Escape_respawn_time = 60; publicVariable ""Escape_respawn_time""; systemChat ""60秒"";'>60秒</execute>  <execute expression = '[90] remoteExec [""setPlayerRespawnTime"", 0]; Escape_respawn_time = 90; publicVariable ""Escape_respawn_time""; systemChat ""90秒"";'>90秒</execute>  <execute expression = '[120] remoteExec [""setPlayerRespawnTime"", 0]; Escape_respawn_time = 120; publicVariable ""Escape_respawn_time""; systemChat ""120秒"";'>120秒</execute>  <execute expression = '[180] remoteExec [""setPlayerRespawnTime"", 0]; Escape_respawn_time = 180; publicVariable ""Escape_respawn_time""; systemChat ""180秒"";'>180秒</execute>  <execute expression = '[300] remoteExec [""setPlayerRespawnTime"", 0]; Escape_respawn_time = 300; publicVariable ""Escape_respawn_time""; systemChat ""300秒"";'>300秒</execute><br/>"]];
		player createDiaryRecord ["Escape__option", ["结束任务！", "<br/><execute expression = '[player,""kk\endMission.sqf""] remoteExec [""execVM"", 2];'>结束！</execute><br/>"]];
		
		ES_Hang_up = true;
		_Trigger_r3 = createTrigger["EmptyDetector",[0,0,0],false];
		_Trigger_r3 setTriggerActivation["CHARLIE","PRESENT",true]; //0-0-3
		_Trigger_r3 setTriggerStatements["this","[] execVM 'kk\Hang_up.sqf'",""];
		_Trigger_r3 setTriggerText "挂机";
		TitleText ["房主/管理员添加0-0-3无线电菜单", "PLAIN"];
		_Trigger_r4 = createTrigger["EmptyDetector",[0,0,0],false];
		_Trigger_r4 setTriggerActivation["DELTA","PRESENT",true]; //0-0-4
		_Trigger_r4 setTriggerStatements["this","[player,'kk\endMission.sqf'] remoteExec ['execVM', 2]",""];
		_Trigger_r4 setTriggerText "结束任务！";
		TitleText ["房主/管理员添加0-0-4无线电菜单", "PLAIN"];
		if (!isServer) then {player setVariable ["Escape_isDSadmin", true,true]};
	};
};
0 spawn {uiSleep 15; call Escape_fn_option2; call Escape_fn_option};
0 spawn {
	waitUntil {!isNil "kk_initPlayerLocal"}; //
	uiSleep 35;
	Escape_dynamicText_x = -1.1;
	_time = time + 30;
	_str1 = if (allow_FailTasks == 0) then [{"任务设定为玩家全部倒下任务不结束！<br/>"},{""}];
	_str2 = if (allow_civ_medic == 1) then [{"玩家倒下后可以呼叫附近的平民进行救治<br/>"},{""}];
	if (!FAR_Enable) then {_str2 = "FAR医疗已禁用，依赖它的功能将会失效<br/>"};
	["Escape_FrameLoop", "onEachFrame", {
		params ["_time","_str1","_str2"];
		if (time > _time) then [{
			["Escape_FrameLoop", "onEachFrame"] call BIS_fnc_removeStackedEventHandler;
		},{
			_time2 = round (_time - time);
			_rate = round (60/diag_fps);
			if (_time2 >= 2.3 && {Escape_dynamicText_x < -0.4}) then {Escape_dynamicText_x = Escape_dynamicText_x + (.005 * _rate)};
			if (_time2 < 2.3 && {Escape_dynamicText_x > -1.1}) then {Escape_dynamicText_x = Escape_dynamicText_x - (.005 * _rate)};
			[format["<t color='#FFFFFF' size = '.6' align = 'left'>说明: <br/><t color='#00FFFF'>%1%2打开地图->帮助->'支援'有医护兵换取选项.<br/><t color='#59FF00'>叛徒每5分钟可切换，靠近友军AI可随意附体.<br/>杀平民后他们会向敌人通风报信.<br/>如果绿军阵营有僵尸是能直接打死人的.<br/>找到情报箱子拿去终端才能撤离.<br/>情报箱子随机刷在最后一个红圈建筑物内.<br/>通过打红圈据点来减少红圈，直到剩下一个.<br/>房主/管理员用无线电菜单0-0-3挂机不影响任务.<br/>全倒下后房主/管理员可以用无线电菜单0-0-4结束任务.<br/>具体说明打开地图查看帮助选项.<br/>2022.02.25<br/></t>", _str1,_str2],Escape_dynamicText_x,.1,1,0,0,73932] spawn BIS_fnc_dynamicText;
		}];
	},[_time,_str1,_str2]] call BIS_fnc_addStackedEventHandler;
	["<t color='#fff000'>重生两次以上任务结束时游戏会崩溃！（win10中文兼容bug）<br/>解决办法: 游戏语言设置为非中文或者更换操作系统</t>",-1,.05 * safezoneH + safezoneY,30,0,0,33] spawn BIS_fnc_dynamicText;
};
0 spawn {
	waitUntil {!isNil "Param_NoNightvision" && {!isNil "ES_Server_id"}};
	private ["_play", "_idx1", "_idx2", "_idx3", "_idx4", "_idx5", "_idx6", "_idx7", "_idx8", "_idx9", "_idx10", "_idx101", "_idx11", "_idx12", "_idx13", "_NVG", "_support1", "_support2", "_support3", "_support4", "_support5", "_support6", "_support7", "_support8", "_support9", "_Sacks1", "_Sacks2", "_Sacks3", "_Sacks4", "_Sacks5", "_Sacks6", "_Sacks7", "_Sacks8", "_Righting", "_Righting2", "_Righting3", "_MoveOutDead", "_PushAside"];
	_idx1 = -1;
	Escape_Mutiny1 = false;
	Escape_support_act = false;
	Sacks_act_hide = true;
	Sacks_act_ensure = false;
	Sacks_act_cancel = false;
	Escape_campActi_arr = [];
	if (isNil "Escape_all_assets") then {Escape_all_assets = []};
	if (isNil "Sacks_blindage_arr") then {Sacks_blindage_arr = []};
	if (isNil "Escape_campType_arr") then {Escape_campType_arr = []};
	if (isNil "Escape_Players_enemy") then {Escape_Players_enemy = []};
	_t1 = time + 60;
	while {true} do {
		if (_idx1 == -1) then {
			_idx1 = player addAction ["<t color=""#00AEFF"">收起武器</t>", {player action ['SwitchWeapon', player, player, 100]}, [], 1.5, false]; // Shoulder weapon
			_idx2 = player addAction ["<t color=""#00AEFF"">CH视距</t>", {call CHVD_fnc_openDialog; hint '视距快捷键ctrl+[ ]\n地形快捷键shift+[ ]'
			}, [], 1.4, false];
			
			Escape_support_idx = player addAction ["<t color='#4169E1'>换取支援-></t>",{Escape_support_act = !Escape_support_act; player setUserActionText (if(Escape_support_act)then[{[Escape_support_idx, "<t color='#4169E1'>换取支援＜-</t>", "收起选项"]},{[Escape_support_idx, "<t color='#4169E1'>换取支援-></t>", "<t color='#00ff00'>展开选项</t>"]}])}, [], 0, false, false, "", "isNil 'Escape_enemySW_side'"];
			player setUserActionText (if(Escape_support_act)then[{[Escape_support_idx, "<t color='#4169E1'>换取支援＜-</t>", "收起选项"]},{[Escape_support_idx, "<t color='#4169E1'>换取支援-></t>", "<t color='#00ff00'>展开选项</t>"]}]);
			_support1 = player addAction ["<t color='#ff8400'> 杀敌人数</t>",{call Escape_killNum_list}, [], 0, false, false, "", "Escape_support_act && {isNil 'Escape_enemySW_side'}"];
			_support2 = player addAction ["<t color='#ff8400'> 火力支援</t>",{call Escape_fn_getCas}, [], 0, false, false, "", "Escape_support_act && {isNil 'Escape_enemySW_side'}"];
			_support3 = player addAction [format["<t color='#ff8400'> %1</t>", Escape_vehKill_str],{0 call Escape_fn_getVeh}, [], 0, false, false, "", "Escape_support_act && {isNil 'Escape_enemySW_side'}"];
			_support4 = player addAction ["<t color='#ff8400'> 摩托艇</t>",{1 call Escape_fn_getVeh}, [], 0, false, false, "", "Escape_support_act && {isNil 'Escape_enemySW_side'}"];
			_support5 = player addAction [format["<t color='#ff8400'> %1</t>", Escape_bikeKill_str],{call Escape_fn_getBike}, [], 0, false, false, "", "Escape_support_act && {isNil 'Escape_enemySW_side'}"];
			_support6 = player addAction ["<t color='#ff8400'> 无人机</t>",{call Escape_fn_getReconUAV}, [], 0, false, false, "", "Escape_support_act && {isNil 'Escape_enemySW_side'}"];
			_support7 = player addAction ["<t color='#ff8400'> 给他1个杀敌数</t>",{1 call Escape_fn_giveKillNum}, [], 0, false, false, "", "Escape_support_act && {isNil 'Escape_enemySW_side'}"];
			_support8 = player addAction ["<t color='#ff8400'> 给他5个杀敌数</t>",{5 call Escape_fn_giveKillNum}, [], 0, false, false, "", "Escape_support_act && {isNil 'Escape_enemySW_side'}"];
			_support9 = player addAction ["<t color='#ff8400'> 消除负面影响（评分归零）</t>",{_rating = rating player; if (_rating < 0) then [{_killNum = player getVariable ["Escape_Kill_num", 0]; if(_killNum < Escape_ReviveKill_num)then[{[format["<t color='#fff000'>杀敌人数不够 还需: %1人</t>", Escape_ReviveKill_num - _killNum],-1,.05 * safezoneH + safezoneY,8,0,0,33] spawn BIS_fnc_dynamicText},{player addRating (abs _rating); player setVariable ["Escape_Kill_num", _killNum - Escape_ReviveKill_num, true]; systemchat format["玩家评分%1, 已归零", _rating]; call Escape_killNum_show}]},{systemchat format["玩家评分%1, 无需重置", _rating]}]}, [], 0, false, false, "", "Escape_support_act && {isNil 'Escape_enemySW_side'}"];

			Escape_Mutiny_idx = player addAction ["<t color='#4169E1'>叛变成敌军-></t>",{Escape_Mutiny1 = !Escape_Mutiny1; player setUserActionText (if (Escape_Mutiny1) then [{[Escape_Mutiny_idx, "<t color='#4169E1'>叛变成敌军＜-</t>", "收起选项"]},{[Escape_Mutiny_idx, "<t color='#4169E1'>叛变成敌军-></t>", "<t color='#00ff00'>展开选项</t>"]}]);}, [], 0, false, false];
			player setUserActionText (if (Escape_Mutiny1) then [{[Escape_Mutiny_idx, "<t color='#4169E1'>叛变成敌军＜-</t>", "收起选项"]},{[Escape_Mutiny_idx, "<t color='#4169E1'>叛变成敌军-></t>", "<t color='#00ff00'>展开选项</t>"]}]);
			_idx3 = player addAction ["<t color='#ff8400'> 叛变名单</t>",{call Escape_Mutiny_nameList}, [], 0, false, false, "", "Escape_Mutiny1"];
			_idx4 = player addAction ["<t color='#ff8400'> 加入蓝方</t>",{west spawn Escape_fn_enemySW}, [], 0, false, false, "", "Escape_Mutiny1"]; //
			_idx5 = player addAction ["<t color='#ff8400'> 加入绿方</t>",{if(isNil "Escape_Zombie_use")then[{resistance spawn Escape_fn_enemySW},{cutText ["不能叛变到该阵营绿军是僵尸！", "Plain"]}]}, [], 0, false,false, "", "Escape_Mutiny1"];
			_idx6 = player addAction ["<t color='#ff8400'> 取消</t>",{Escape_cancelSW_enemy = true}, [], 0, false, false, "", "Escape_Mutiny1"];
			
			_idx7 = player addAction ["<t color='#00ffff'>拿起箱子（情报）</t>",{if (isNil "A3E_Task_intel_Complete") then {A3E_Task_intel_Complete = 1; publicVariable "A3E_Task_intel_Complete"}; if (!isNil "Escape_enemySW_side" && {missionNamespace getVariable ["Escape_intelAllowTake_time", 1] > 0}) exitWith {["<t color='#fff000' size = '.8'>你需要等待倒计时完才能拿起.</t>",-1,-1,4,2,0,789] spawn BIS_fnc_dynamicText}; detach Escape_intel_box; Escape_intel_box attachTo [player, [0,0,-.2], "lefthand"]; [Escape_intel_box,90] remoteExec ["setDir",0]; if (!isNil "Escape_enemySW_side") then {if (getMarkerColor "Escape_Mutiny_evacMak" == "") then {Escape_MutinyEvacMak = 1; publicVariable "Escape_MutinyEvacMak"}; ["<t color='#fff000' size = '.8'>敌人拿起情报！</t>",-1,-1,4,2,0,789] remoteExec ["BIS_fnc_dynamicText",0]}}, [], 2, true, true, "", "!isNull Escape_intel_box && {Escape_intel_box distance player < 1.5} && {isNull objectParent player} && {isNull attachedTo Escape_intel_box}"];
			_idx8 = player addAction ["<t color='#00ffff'>拿出箱子</t>",{detach Escape_intel_box; Escape_intel_box setPosASL (getPosASL player)}, [], 2, true, true, "", "!isNull Escape_intel_box && {!isNull attachedTo Escape_intel_box} && {!(attachedTo Escape_intel_box isKindOf 'CaManBase')} && {attachedTo Escape_intel_box distance player < 9} && {isNull objectParent player}"];
			_idx9 = player addAction ["<t color='#00ffff'>放下箱子</t>",{detach Escape_intel_box}, [], 2, true, true, "", "!isNull Escape_intel_box && {attachedTo Escape_intel_box == player}"];
			
			_idx10 = player addAction ["<t color='#4169E1'>小地图</t>",{0 spawn compile preprocessFileLineNumbers 'hud_map\minimap.sqf'}, [], 0, false, true, "", "!isNil 'Escape_enemySW_side'"];
			_idx101 = player addAction ["<t color='#4169E1'>切换到友军</t>",{0 spawn Escape_fn_enemySW3}, [], 0, false, true, "", "!isNil 'Escape_enemySW_side' && {call Escape_enemySW_check}"];
			_idx11 = player addAction ["<t color='#4169E1'>离开小队</t>",{[player] join (createGroup [side player, true]); systemchat "你已经离开了队伍"}, [], 0, false, true, "", "!isNil 'Escape_enemySW_side' && {count units player > 1}"];
			
			_idx12 = player addAction ["<t color='#00ffff'>扶正自行车</t>",{_veh = vehicle player; _veh setVehiclePosition [_veh,[],0,"CAN_COLLIDE"]}, [], 2, false, true, "", "call Righting_Bike_Check"];
			_idx13 = player addAction ["<t color='#C90000'>自杀</t>",{0 spawn Escape_fn_suicide}, [], -2, false, true];
			
			_NVG = player addAction ["<img image='images\fsnvg32.paa'/> <t color='#66ff00'>切换夜视模式</t>",'kk\NVG.sqf', [], -111, false, false, "", "Escape_NVG_en == 1"];
			
			_Sacks1 = player addAction ["<t color='#32cd32'>建造掩体</t>",{0 spawn Sacks_blindage_pv}, [], -990, false, false, "", "vehicle player == player && {stance player == 'STAND'} && {Sacks_act_hide}"];
			_Sacks2 = player addAction ["<t color='#C90000'>删除掩体</t>",{Sacks_blindage_arr = Sacks_blindage_arr - [sacks_del_tag]; publicVariable "Sacks_blindage_arr"; deleteVehicle sacks_del_tag}, [], -990, false, false, "", "call Sacks_delete_Check"];
			_Sacks3 = player addAction ["<t color='#32cd32'>确定</t>",{Sacks_blindage_ensure = true}, [], 99, true, true, "", "Sacks_act_ensure"];
			_Sacks4 = player addAction ["<t color='#32cd32'>方向 +</t>",{Sacks_blindage_obj setDir (((getDir Sacks_blindage_obj) - (getDir player)) + 22.5)}, [], 99, true, false, "", "Sacks_act_ensure"];
			_Sacks5 = player addAction ["<t color='#32cd32'>方向 -</t>",{Sacks_blindage_obj setDir (((getDir Sacks_blindage_obj) - (getDir player)) - 22.5)}, [], 99, true, false, "", "Sacks_act_ensure"];
			_Sacks6 = player addAction ["<t color='#32cd32'>高度 +</t>", {_obj = Sacks_blindage_obj; _offset = _obj getVariable ["attach_offset_kk", [0,_obj distance2D player,.5]]; _offset set [2,(_offset select 2)+.5]; _obj setVariable ["attach_offset_kk", _offset]; _obj attachTo [player, _offset]},[],99,true,false,"","Sacks_act_ensure"];
			_Sacks7 = player addAction ["<t color='#32cd32'>高度 -</t>", {_obj = Sacks_blindage_obj; _offset = _obj getVariable ["attach_offset_kk", [0,_obj distance2D player,.5]]; _offset set [2,(_offset select 2)-.25]; _obj setVariable ["attach_offset_kk", _offset]; _obj attachTo [player, _offset]},[],99,true,false,"","Sacks_act_ensure"];
			_Sacks8 = player addAction ["<t color='#32cd32'>取消</t>",{Sacks_blindage_cancel = true}, [], 99, true, true, "", "Sacks_act_cancel"];
			
			_righting = player addAction ["<t color='#ff8400'>扶正武器</t>",{righting_tag setVehiclePosition [righting_tag,[],0,"CAN_COLLIDE"]}, [], 63, true, true, "", "call righting_wep_Check"];
			_righting2 = player addAction ["<t color='#ff8400'>旋转武器 +</t>",{true call Righting_wep_dir}, [], 63, false, false, "", "call righting_wep_Check2"];
			_righting3 = player addAction ["<t color='#ff8400'>旋转武器 -</t>",{false call Righting_wep_dir}, [], 63, false, false, "", "call righting_wep_Check2"];
			
			_MoveOutDead = player addAction ["<t color='#00FFFF'>搬出尸体</t>",{_v = cursorTarget; if (isServer) then [{_v spawn MoveOut_Dead_main},{MoveOut_Dead_v = _v; publicVariableServer "MoveOut_Dead_v"}]}, [], -992, true, true, "", "call MoveOut_Dead_Check"];
			
			_PushAside = player addAction ["<t color='#32cd32'>拨开尸体（装备）</t>",{PushAside_obj setVehiclePosition [(if(getPos PushAside_obj select 2 < -.1)then[{player},{PushAside_obj}]), [], 2, "CAN_COLLIDE"]}, [], -993, true, false, "", "call k1_PushAside_Check"];
			
			player setCustomAimCoef (Escape_CustomAimCoef/10);
			if (attachedTo Escape_intel_box isKindOf "CaManBase") then {Escape_intel_box setDir 90};
			if (!isNil "Escape_enemySW_side") then {player setVariable ["FAR_downMak_en", false]};
			call Escape_fn_option2;
			if (serverCommandAvailable "#kick" && {!isServer}) then {player setVariable ["Escape_isDSadmin", true,true]};
			_play = player;
		};
		if (_play != player) then {
			{_play removeAction _x} forEach [_idx1, _idx2, Escape_Mutiny_idx, _idx3, _idx4, _idx5, _idx6, _idx7, _idx8, _idx9, _idx10, _idx101, _idx11, _idx12, _idx13, _NVG, Escape_support_idx, _support1, _support2, _support3, _support4, _support5, _support6, _support7, _support8, _support9, _Sacks1, _Sacks2, _Sacks3, _Sacks4, _Sacks5, _Sacks6, _Sacks7, _Sacks8, _Righting, _Righting2, _Righting3, _MoveOutDead, _PushAside];
			_idx1 = -1;
		};
		call Escape_fn_option; //
		_veh = vehicle player;
		if (Escape_MutinyUseWep == 1 && {_veh != player} && {isNil "Escape_enemySW_side"} && {!(_veh getVariable ["Escape_vehWep_Used", false])} && {local _veh}) then {_veh setVariable ["Escape_vehWep_Used", true,true]};
		if (isNil "Escape_enemySW_side") then [{
			private ["_mak","_mak2","_cor","_radius","_str"];
			_mak = "Escape_greenCircle_mak";
			_mak2 = "Escape_greenCircle_mak2";
			if (!isNil "Escape_ply_greenCircle") then [{
				if (getMarkerColor _mak == "") then {
					_mak = createMarkerLocal [_mak, Escape_greenCircle_pos];
					_mak setMarkerBrushLocal "SOLID";
					_mak setMarkerShapeLocal "ELLIPSE";
					_mak setMarkerColorLocal "ColorGreen";
					_mak setMarkerSizeLocal [Escape_greenCircle_radius, Escape_greenCircle_radius];
					_mak2 = createMarkerLocal [_mak2, Escape_greenCircle_pos];
					_mak2 setMarkerTypeLocal "hd_dot";
					_mak2 setMarkerColorLocal "ColorYellow";
					_mak2 setMarkerTextLocal "集合！";
					_mak2 setMarkerSizeLocal [.4,.4];
				};
				_str = if(Escape_greenCircle_radius > 100)then[{format["绿圈%1秒后缩小, ", missionNamespace getVariable ["Escape_greenCircle_time",0]]},{format["%1秒 ", missionNamespace getVariable ["Escape_greenCircle_time",0]]}];
				_cor = if(getPosASL player inArea _mak)then[{'#00ff00'},{'#ff0000'}];
				[format["<t color='%1'>%2在绿圈外将被杀死！</t>", _cor,_str],-1,.1 * safezoneH + safezoneY,3,0,0,34] spawn BIS_fnc_dynamicText;
			},{
				if (getMarkerColor _mak != "") then {deleteMarkerLocal _mak; deleteMarkerLocal _mak2};
			}];
			_mak = "Escape_greenCircle2_mak";
			if (getMarkerColor _mak != "") then {
				_str = if(Escape_greenCircle2_radius > Escape_greenCircle2_dis)then[{format["绿圈%1秒后缩小, ", missionNamespace getVariable ["Escape_greenCircle2_time",0]]},{format["%1秒 ", missionNamespace getVariable ["Escape_greenCircle2_time",0]]}];
				_cor = if(getPosASL player inArea _mak)then[{'#00ff00'},{'#ff0000'}];
				[format["<t color='%1'>撤离点已激活, 请脱离战斗快速会合！<br/>%2在绿圈外将被杀死！</t>", _cor,_str],-1,.1 * safezoneH + safezoneY,3,0,0,34] spawn BIS_fnc_dynamicText;
			};
		},{
			if (((Escape_MutinyUseAssets == 1 && {_veh != player} && {_veh in Escape_all_assets} && {_veh getVariable ["Escape_assets_control", false]}) || {Escape_MutinyUseWep == 1 && {player call Escape_vehWep_check}}) && {alive player}) then {
				moveOut player;
				["<t color='#fff000' size = '.8'>禁止使用！</t>",-1,-1,4,2,0,789] spawn BIS_fnc_dynamicText;
			};
			if (!isNil "FAR_Enable" && {FAR_Enable}) then {FAR_Enable = false}; //
			if (!isNil "FAR_killFriend" && {FAR_killFriend}) then {FAR_killFriend = false}; //debug
		}];
		if (time > _t1 && {isNil "Escape_enemySW_side"} && {!isServer}) then {
			_killNum = player getVariable ["Escape_Kill_num", 0];
			profileNamespace setVariable ["ES_SAVE_KillNum",[ES_Server_id,_killNum]];
			_t1 = time + 60;
		};
		{
			_x params ["_pos","_type","_author"];
			if (player distance _pos < 200) then {
				[parseText format ["<t font='EtelkaMonospaceProBold' color='#ffffff' size = '1.4'>当前<t color='#dc143c'>%1<br/><t color='#ffffff'>由 <t color='#dc143c'>%2<t color='#ffffff'> 制作</t>", _type,_author], true, nil, 5, .7, 0] spawn BIS_fnc_textTiles;
				Escape_campActi_arr pushback _x;
			};
		} forEach Escape_campType_arr - Escape_campActi_arr;
		{
			if (isObjectHidden _x) then {_x hideObject false};
			if (!simulationEnabled _x) then {_x enableSimulation true};
		} forEach Escape_Players_enemy;
		sleep 1;
	};
};
0 spawn {
	while {true} do {
		waitUntil {!alive player};
		if (!isNil "Escape_enemySW_side") exitWith {};
		Escape_RespawnPos_sw = true;
		Escape_RespawnPos_sw_t = 0;
		_key = (findDisplay 46) displayAddEventHandler ["KeyDown", {
			if (time > Escape_RespawnPos_sw_t) then {
				if (_this select 1 == 18) then {
					Escape_RespawnPos_sw = !Escape_RespawnPos_sw;
					_str = if(Escape_RespawnPos_sw)then[{"队友身边"},{"队友远处"}];
					[format["<t color='#fff000'>重生在: %1</t>", _str],-1,.05 * safezoneH + safezoneY,999,0,0,33] spawn BIS_fnc_dynamicText;
				};
				Escape_RespawnPos_sw_t = time + .5;
			};
		}];
		["<t color='#fff000'>重生在: 队友身边 (E键切换)</t>",-1,.05 * safezoneH + safezoneY,999,0,0,33] spawn BIS_fnc_dynamicText;
		waitUntil {alive player};
		["",1,1,3,0,0,33] spawn BIS_fnc_dynamicText;
		(findDisplay 46) displayRemoveEventHandler ["KeyDown", _key];
	};
};
if (kk_setUnitTrait == 1) then {call kk_fn_UnitTrait};
/////////////////////////////////JIP玩家传送到队友身边////////////////////////////////
Escape_RespawnPos_sw = true;
0 spawn {
//uiSleep 15; //
waitUntil {a3e_var_Escape_firstPreloadDone && {!isNil "ply_jip_debug1"}};//
if (ply_jip_debug1) exitWith {};
uiSleep 5; //
_playableUnits = [];
_players = call A3E_fnc_GetPlayers;
_players2 = _players - [player] - (if(count _players > 2)then[{[Player_Server]},{[]}]) - Escape_Players_enemy;
{
	if ((leader group _x) distance _x < 4999 && {!(_x getVariable ["FAR_is_killFriend", false])}) then {_playableUnits pushback _x};
} forEach _players2;
if (count _playableUnits == 0) then {{if !(_x getVariable ["FAR_is_killFriend", false]) then {_playableUnits pushback _x}} forEach _players2};
if (count _playableUnits > 0 && {({player distance _x < 500} count _playableUnits) == 0} && {count playableUnits > 1} && {alive player}) then {
	_Friendly = selectRandom _playableUnits;
	_Friendly call Escape_PlyToFriendly;
	Format["debug: 新玩家 %1 重生到 %2", name player, name _Friendly] remoteExec ['systemChat', 0];
}};
///////////////////////////////////////////
player addEventHandler ["Respawn",{
call at_fnc_dh_init; //入侵UAV
call A3E_fnc_addUserActions; //入侵终端..
if (!isNil "ES_Hang_up" && {!ES_Hang_up}) then {Player_Server = player; publicVariable "Player_Server"};
if (isNil "Escape_enemySW_side") then {
_players = playableUnits - [player, Player_Server] - Escape_Players_enemy;
_units = []; {if((leader group _x) distance _x < 4999 && {!(_x getVariable ["FAR_is_killFriend", false])})then {_units pushback _x}} forEach _players;
if (count _units == 0) then {{if !(_x getVariable ["FAR_is_killFriend", false]) then {_units pushback _x}} forEach _players};
if (count _units > 0) then [{_Friendly = selectRandom _units; _Friendly call Escape_PlyToFriendly},{player call Escape_PlyToFriendly}];
};}];
///////////////////////////////////////////////////////////////////////////////////////////////////////////
[] execVM "outlw_magRepack\MagRepack_init_sv.sqf"; //弹夹整理
[] execVM "kk\repeatPlyAnim.sqf"; //动作重复，自动行走

////////////////////////////////////////////////////////////////////////
if (isServer) exitWith {};
0 spawn {
	waitUntil {!isNil "ES_Server_id"};
	_arr = profileNamespace getVariable ["ES_SAVE_KillNum",["",0]];
	_sID = _arr select 0;
	_num = _arr select 1;
	if (_sID == ES_Server_id && {_num != 0}) then {
		player setVariable ["Escape_Kill_num", _num, true];
		uiSleep 22;
		systemchat "载入杀敌人数.";
		call Escape_killNum_show;
	};
};
0 spawn {
disableSerialization;
waitUntil {
	if (isNil "DB_allow_Quit") then {
		waitUntil {!isNull (findDisplay 49)};
		((findDisplay 49) displayCtrl 104) ctrlEnable false;
	};
	if (!isNil "Escape_mission_end") exitWith {((findDisplay 49) displayCtrl 104) ctrlEnable true; true};
	if (isNil "DB_findDisplay_49") then {
		DB_findDisplay_49 = 1;
		0 spawn {
			[[
				["中止计时开始！","<t align = 'center' size = '2'>%1</t><br/>"],
				["10 秒...","<t align = 'center' size = '2'>%1</t><br/>"],
				["10 秒后可以中断连接","<t align = 'center' color='#ffff00' size = '.7'>%1</t>"]
			]] spawn BIS_fnc_typeText;
			_t = time + 5.5;
			waitUntil {time > _t || {!isNil "Escape_mission_end"}};

			_time = time + 10;
			_time2 = time;
			waitUntil {
				if (time >= _time2) then {
					[format["<t size = '.8'>%1 秒后可以中断连接</t>", round (_time - time)],0,.1 * safeZoneH + safeZoneY,3,0,0,4673] spawn BIS_fnc_dynamicText;
					_time2 = time + .5;
				};
				(isNull (findDisplay 49) || {time > _time} || {!isNil "Escape_mission_end"})
			};

			if (!isNull (findDisplay 49)) then {
				DB_allow_Quit = 1;
				((findDisplay 49) displayCtrl 104) ctrlEnable true;
				[[
					["你现在可以中止了，抱歉耽误了你宝贵的时间。","<t align = 'center' size = '2'>%1</t><br/>"]
				]] spawn BIS_fnc_typeText;
				waitUntil {isNull (findDisplay 49)};
			};
			DB_allow_Quit = nil;
			DB_findDisplay_49 = nil;
		};
	};
	sleep .1;
	false
};};
/////////////////////////
0 spawn {
	_cac = Escape_CustomAimCoef/10;
	waitUntil {
		if (!isNull (uiNamespace getVariable ["RscDisplayArsenal", displayNull]) && {!serverCommandAvailable "#kick"}) then {
			(uiNamespace getVariable ["RscDisplayArsenal", displayNull]) closeDisplay 1;
		};
		if (ctrlVisible 2950) then {closedialog 0}; //VAS
		if (getCustomAimCoef player < _cac) then {player setCustomAimCoef _cac};
		if (unitRecoilCoefficient player < 1) then {player setUnitRecoilCoefficient 1};
		sleep .3;
		false
	};
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////


